![]() ![]() ![]() ![]() |
|
HiPi::Device::GPIO::Pin provides an implementation of HiPi::Pin for the HiPi::Device::GPIO module
The module inherits all of most of its methods from HiPi::Pin.
use 5.14.0; # for say use HiPi::Device::GPIO; use HiPi::Constant qw( :raspberry ); my $dev = HiPi::Device::GPIO->new(); my $pin = $bcm->get_pin( RPI_PAD1_PIN_11 ); my $mode = $pin->mode(); if( $mode & RPI_PINMODE_OUTP ) { # set high $pin->value(1); } elsif( $mode & RPI_PINMODE_INPT ) { say q(Current Pin Value is :) . $pin->value(); # set rising edge interrupt $pin->interrupt( RPI_INT_RISE ); }
Returns the current active low setting for the pin. Either 1 or 0 for on or off. If the optional param $onoff is supplied ( 1 or 0 ) that setting is applied to the pin.