NAME
RPi::WiringPi::Core - Perl wrapper for Raspberry Pi's wiringPi Core and System functions
DESCRIPTION
You probably want to use the RPi::WiringPi module instead of this one.
This is an XS-based module, and requires wiringPi to be installed.
It provides Perl method access to (at this time, most of) the wiringPi Core along with a few of its system functions.
Although this module can be used directly, it's generally used as a base class for other modules.
METHODS
new()
Returns a new RPi::WiringPi::Core
object.
setup()
See wiringPi setup functions for for information on this method.
setup_sys()
See wiringPi setup functions for for information on this method.
setup_gpio()
See wiringPi setup functions for for information on this method.
pin_mode($pin, $mode)
Puts the GPIO pin in either INPUT or OUTPUT mode.
Parameters:
$pin
Mandatory: The GPIO pin number, using wiringPi's pin number representation.
$mode
Mandatory: 0
to have the pin listen on INPUT, and 1
for OUTPUT.
read_pin($pin);
Returns the current state (HIGH/on, LOW/off) of a given pin.
Parameters:
$pin
Mandatory: The wiringPi number representation of the GPIO pin.
write_pin($pin, $state)
Sets the state (HIGH/on, LOW/off) of a given pin.
Parameters:
$pin
Mandatory: The wiringPi number representation of the GPIO pin.
$state
Mandatory: 1
to turn the pin on (HIGH), and 0
to turn it LOW (off).
pull_up_down($pin, $direction)
Enable/disable the built-in pull up/down resistors for a specified pin.
Parameters:
$pin
Mandatory: The wiringPi number representation of the GPIO pin.
$direction
Mandatory: 2
for UP, 1
for DOWN and 0
to disable the resistor.
pwm_write($pin, $value)
Sets the Pulse Width Modulation duty cycle (on time) of the pin.
Parameters:
$pin
Mandatory: The wiringPi number representation of the GPIO pin.
$value
Mandatory: 0
to 1024
. 0
is 0% (off) and 1024
is 100% (fully on).
get_alt($pin)
This returns the current mode of the pin (using getAlt()
C call). Modes are INPUT 0
, OUTPUT 1
, PWM 2
and CLOCK 3
.
Parameters:
$pin
Mandatory: The wiringPi number representation of the GPIO pin.
AUTHOR
Steve Bertrand, <steveb@cpan.org>
COPYRIGHT AND LICENSE
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.