RPi-WiringPi
view release on metacpan or search on metacpan
## rtc
Creates a new [RPi::RTC::DS3231](https://metacpan.org/pod/RPi%3A%3ARTC%3A%3ADS3231) object which provides access to the `DS3231`
or `DS1307` real-time clock modules.
See the linked documentation for full documentation on usage, or the
[RPi::WiringPi::FAQ](https://metacpan.org/pod/RPi%3A%3AWiringPi%3A%3AFAQ) for some usage examples.
Parameters:
$i2c_addr
Optional, Integer: The I2C address of the RTC module. Defaults to `0x68` for
the `DS3231` unit.
## eeprom
Creates and returns a new [RPi::EEPROM::AT24C32](https://metacpan.org/pod/RPi%3A%3AEEPROM%3A%3AAT24C32) object for reading and writing
to.
See the linked documentation for full documentation on usage, parameters or the
[RPi::WiringPi::FAQ](https://metacpan.org/pod/RPi%3A%3AWiringPi%3A%3AFAQ) for some usage examples.
## expander
Creates a new [RPi::GPIOExpander::MCP23017](https://metacpan.org/pod/RPi%3A%3AGPIOExpander%3A%3AMCP23017) GPIO expander chip object. This
adds an additional 16 pins across two banks (8 pins per bank).
See the linked documentation for full documentation on usage, or the
[RPi::WiringPi::FAQ](https://metacpan.org/pod/RPi%3A%3AWiringPi%3A%3AFAQ) for some usage examples.
Parameters:
$i2c_addr
Optional, Integer: The I2C address of the device. Defaults to `0x20`.
$expander
Optional, String: The GPIO expander device type. Defaults to `MCP23017`, and
currently, this is the only option available.
## serial($device, $baud)
Creates a new [RPi::Serial](https://metacpan.org/pod/RPi%3A%3ASerial) object which allows basic read/write access to a
serial bus.
See the linked documentation for full documentation on usage, or the
[RPi::WiringPi::FAQ](https://metacpan.org/pod/RPi%3A%3AWiringPi%3A%3AFAQ) for usage examples.
NOTE: On the Pi 3 and Pi 4, Bluetooth occupies the primary UART, leaving the
header pins (14, 15) on the mini-UART (`/dev/ttyS0`). To put the full PL011
UART back on the header you must disable Bluetooth in the
`/boot/firmware/config.txt` file (`/boot/config.txt` on releases before
Bookworm):
dtoverlay=pi3-disable-bt-overlay
On the Pi 5, Bluetooth has its own dedicated UART, so no `disable-bt` overlay
is needed; simply enable the header UART (`/dev/ttyAMA0`) with `enable_uart=1`.
## servo($pin\_num)
This method configures PWM clock and divisor to operate a typical 50Hz servo,
and returns a special [RPi::Pin](https://metacpan.org/pod/RPi%3A%3APin) object. These servos have a `left` pulse of
`50`, a `centre` pulse of `150` and a `right` pulse of `250`. On exit of
the program (or a crash), we automatically clean everything up properly.
Parameters:
$pin_num
Mandatory, Integer: The pin number (technically, this \*must\* be `18` on the
Raspberry Pi 3, as that's the only hardware PWM pin.
%pwm_config
Optional, Hash. This parameter should only be used if you know what you're
doing and are having very specific issues.
Keys are `clock` with a value that coincides with the PWM clock speed. It
defaults to `192`. The other key is `range`, the value being an integer that
sets the range of the PWM. Defaults to `2000`.
Example:
my $servo = $pi->servo(18);
$servo->pwm(50); # all the way left
$servo->pwm(250); # all the way right
## shift\_register($base, $num\_pins, $data, $clk, $latch)
Allows you to access the output pins of up to four 74HC595 shift registers in
series, for a total of eight new output pins per register. Numerous chains of
four registers are permitted, each chain uses three GPIO pins.
Parameters:
$base
Mandatory: Integer, represents the number at which you want to start
referencing the new output pins attached to the register(s). For example, if
you use `100` here, output pin `0` of the register will be `100`, output
`1` will be `101` etc.
$num_pins
Mandatory: Integer, the number of output pins on the registers you want to use.
Each register has eight outputs, so if you have a single register in use, the
maximum number of additional pins would be eight.
$data
( run in 1.449 second using v1.01-cache-2.11-cpan-600a1bdf6e4 )