Skip to content

donaldh/Perl6-RPi-GpioDirect

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
t
 
 
 
 
 
 
 
 

RPi::GpioDirect

Access the Raspberry Pi GPIO

Overview

The RPi::GpioDirect module provides access to the Raspberry Pi GPIO without any dependency on C libraries. RPi::GpioDirect makes use of /dev/gpiomem so that it can run without elevated privileges.

RPi::GpioDirect has only been tested with a Raspberry Pi 3 but is likely to work with a Pi 2. RPi::GpioDirect is also dependent on a kernel with /dev/gpiomem.

Installation

$ panda install RPi::GpioDirect

Usage

use RPi::GpioDirect;

my $pi = RPi::GpioDirect.new;

say 'Pin  Name      Value  Mode';
for $pi.gpio-pins -> $pin {
    say sprintf('%2s   %-8s  %5s  %4s',
                $pin, $pi.pin-name($pin), $pi.read($pin), $pi.function($pin)
               );
}

say '';
say 'Pin  Name      Value';
for 11, 12 -> $pin {
    $pi.set-function($pin, Out);
    for Off, On, Off, On -> $value {
        $pi.write($pin, $value);
        say sprintf('%2s   %-8s  %5s',
                    $pin, $pi.pin-name($pin), $pi.read($pin));
    }
}

Author

Donald Hunter - donaldh @ #perl6

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Other 100.0%