RPi-WiringPi
view release on metacpan or search on metacpan
lib/RPi/WiringPi/FAQ.pod view on Meta::CPAN
Example output:
Core CPU temperature: 46.7 C : 116.06 F
=head3 GPIO information
B<Note>: if you do not supply an array reference with pin numbers, by default,
we'll return the information for *all* GPIO pins.
my $pin_21_info = $pi->gpio_info([21]);
my $multi_pin_info = $pi->gpio_info([2, 4, 6]);
say "Pin 21 info:";
say "$pin_21_info\n";
say "Multi-pin info:";
say $multi_pin_info;
Example output:
Pin 21 info:
GPIO 21: level=0 fsel=0 func=INPUT
Multi-pin info:
GPIO 2: level=1 fsel=4 alt=0 func=SDA1
GPIO 4: level=0 fsel=1 func=OUTPUT
GPIO 6: level=0 fsel=1 func=OUTPUT
The example above shows the legacy C<raspi-gpio> output. On current Raspberry Pi
OS (and on the Pi 5, where C<raspi-gpio> never existed) the data is collected
with C<pinctrl>, whose lines instead read like C<< 2: ip pu | hi // GPIO2 = input >>.
=head3 Boot configuration settings
say $pi->raspi_config;
Example output (significantly snipped for brevity):
arm_freq=1200
audio_pwm_mode=514
config_hdmi_boost=5
core_freq=250
desired_osc_freq=0x36ee80
...
dtparam=i2c_arm=on
dtparam=spi=on
dtparam=audio=on
enable_uart=1
dtparam=i2c_arm_baudrate=10000
dtoverlay=pi3-disable-bt-overlay
dtoverlay=spi-bcm2835
=head3 Network configuration information
say $pi->network_info;
This method returns the output of C<ifconfig> where the C<net-tools> package is
installed, falling back to C<ip addr> where it is not (as on current Raspberry
Pi OS Lite). Both forms carry the interface C<inet>/C<inet6> addresses.
=head3 File system information
say $pi->file_system;
Example output:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 61289372 3375520 55373576 6% /
devtmpfs 470116 0 470116 0% /dev
tmpfs 474724 0 474724 0% /dev/shm
tmpfs 474724 24140 450584 6% /run
tmpfs 5120 4 5116 1% /run/lock
tmpfs 474724 0 474724 0% /sys/fs/cgroup
/dev/mmcblk0p1 43234 22035 21199 51% /boot
tmpfs 94944 0 94944 0% /run/user/1000
Filename Type Size Used Priority
/var/swap file 102396 0 -2
=head3 Pi board and OS details
say $pi->pi_details;
Raspberry Pi 3 Model B Rev 1.2
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
Linux pi-test 6.6.31+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29) aarch64 GNU/Linux
Revision : a22082
Serial : 000000005d916dc3
Model : Raspberry Pi 3 Model B Rev 1.2
Board : Raspberry Pi 3 Model B Rev 1.2
SoC / RAM : BCM2837, 1GB, Embest
Throttled flag : throttled=0x0
Camera : none detected (libcamera)
=head3 Pi model name
say $pi->pi_model;
Example output:
Raspberry Pi 3 Model B Rev 1.2
This is the normalized board name, read from the devicetree model with a
C</proc/cpuinfo> revision-code decode fallback. It works across the Pi 0 through
5 (the Pi 5's RP1-based board included).
=head1 PIN
=head2 Creating and using a GPIO pin object
The L<RPi::Pin> class provides you with objects that directly map to the
Raspberry Pi's onboard GPIO pins. You generate a pin object through the main
C<$pi> object we created above. See that documentation for full usage
( run in 1.704 second using v1.01-cache-2.11-cpan-9581c071862 )