![]() ![]() ![]() ![]() |
|
HiPi::Device::GPIO::Pin provides an implementation of HiPi::Pin for the HiPi::Device::GPIO module.
The module inherits most of its methods from HiPi::Pin.
See Also
use 5.14.0; # for say use HiPi::Device::GPIO; use HiPi::Constant qw( :raspberry ); my $dev = HiPi::Device::GPIO->new(); $dev->export_pin( RPI_PAD1_PIN_11 ); ..... my $pin = $dev->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 ); } # As a convenience, the HiPi::Device::GPIO method export_pin also # returns a HiPi::Device::GPIO::Pin object; my $dev = HiPi::Device::GPIO->new(); my $pin = $dev->export_pin( RPI_PAD1_PIN_11 );
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.