The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

RPi::PIGPIO::Device::LED - Turn on and off a LED

DESCRIPTION

Turn on and off a led connected to a local or remote RapsberryPi

What this actually does is set the GPIO to output and allow you to set the levels to HI or LOW

SYNOPSIS

use RPi::PIGPIO;
use RPi::PIGPIO::Device::LED;

my $pi = RPi::PIGPIO->connect('192.168.1.10');

my $led = RPi::PIGPIO::Device::LED->new($pi,17);

$led->on;

sleep 3;

$led->off;

METHODS

new

Create a new object

Usage:

my $led = RPi::PIGPIO::Device::LED->new($pi,$gpio);

Arguments:

  • $pi - an instance of RPi::PIGPIO

  • $gpio - GPIO number to which the LED is connected

on

Turn on the led

Usage :

$led->on();

off

Turn off the led

Usage :

$led->off();

status

Returns the status of the led (checks if the GPIO is set to HI or LOW)