RPi::WiringPi - Perl interface to Raspberry Pi's board/GPIO pin functionality
use RPi::WiringPi; use constant { INPUT => 0, OUTPUT => 1, ON => 1, OFF => 0, }; my $pi = RPi::WiringPi->new; my $gpio_pin_1 = $pi->pin(1); my $gpio_pin_2 = $pi->pin(2); $gpio_pin_1->mode(INPUT); $gpio_pin_2->mode(OUTPUT) my $is_hot = $gpio_pin_1->read; if ($is_hot){ $gpio_pin_2->write(ON); } $pi->cleanup;
This is the root module for the RPi::WiringPi system. It interfaces to a Raspberry Pi board, its accessories and its GPIO pins via the wiringPi library through the Perl wrapper RPi::WiringPi::Core module.
RPi::WiringPi
Although this module contains no XS code, the RPi::WiringPi::Core module which other modules in this distribution relies on does.
RPi::WiringPi::Core
wiringPi must be installed prior to installing/using this module.
Returns a new RPi::WiringPi object.
Returns a RPi::WiringPi::Pin object, mapped to a specified GPIO pin.
Parameters:
$pin_num
Mandatory: The wiringPi representation of the GPIO pin number.
wiringPi
Resets all registered pins back to default settings (off). It's important that this method be called in each application.
These methods aren't normally needed by end-users. They're available for those who want to write their own libraries.
Returns an array of RPi::WiringPi::Pin objects that are currently registered, and deemed to be in use.
Registers a GPIO pin within the system for error checking, and proper resetting of the pins in use when required.
$pin_obj
Mandatory: An object instance of RPi::WiringPi::Pin class.
Exactly the opposite of register_pin().
register_pin()
There are certain environment variables available to aid in testing on non-Raspberry Pi boards.
Set to true, will bypass the wiringPi board checks. False will re-enable them.
Steve Bertrand, <steveb@cpan.org>
Copyright (C) 2016 by Steve Bertrand
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.18.2 or, at your option, any later version of Perl 5 you may have available.
To install RPi::WiringPi, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RPi::WiringPi
CPAN shell
perl -MCPAN -e shell install RPi::WiringPi
For more information on module installation, please visit the detailed CPAN module installation guide.