HiPi
Perl Modules for Raspberry Pi
Version 0.67 - released 08 October 2017

HiPi::GPIO::Pin

Provides wrappers around the pin functions provided by the HiPi::GPIO module.

use HiPi qw( :rpi );
use HiPi::GPIO;
             
my $gpio = HiPi::GPIO->new;
my $pin = $gpio->get_pin( RPI_PIN_11 );
$pin->value( RPI_HIGH );

Methods

Get or set the pin level

$pin->value( 1 );
my $level = $pin->value;

Get or set the current pin mode. Normally RPI_MODE_INPUT or RPI_MODE_OUTPUT but can use any of the following constants:

RPI_MODE_INPUT
RPI_MODE_OUTPUT
RPI_MODE_ALT0
RPI_MODE_ALT1
RPI_MODE_ALT2
RPI_MODE_ALT3
RPI_MODE_ALT4
RPI_MODE_ALT5
$pin->mode( RPI_MODE_OUTPUT );
my $mode = $pin->mode;

Set or remove the internal Pull Up or Pull Down resistor on the pin. Uses constants:

RPI_PUD_OFF
RPI_PUD_DOWN
RPI_PUD_UP
$pin->set_pud( RPI_PUD_UP );

Return descriptive text for the current pin function.

my $description = $pin->get_function();