RPi-WiringPi

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    and currently, this is the only option available.

 serial($device, $baud)

    Creates a new RPi::Serial 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 for usage examples.

    NOTE: Bluetooth on the Pi overlays the serial pins (14, 15) on the Pi.
    To use serial, you must disable bluetooth in the /boot/config.txt file:

        dtoverlay=pi3-disable-bt-overlay

 servo($pin_num)

    This method configures PWM clock and divisor to operate a typical 50Hz
    servo, and returns a special RPi::Pin 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:

lib/RPi/WiringPi.pm  view on Meta::CPAN

currently, this is the only option available.

=head2 serial($device, $baud)

Creates a new L<RPi::Serial> object which allows basic read/write access to a
serial bus.

See the linked documentation for full documentation on usage, or the
L<RPi::WiringPi::FAQ> for usage examples.

NOTE: Bluetooth on the Pi overlays the serial pins (14, 15) on the Pi. To use
serial, you must disable bluetooth in the C</boot/config.txt> file:

    dtoverlay=pi3-disable-bt-overlay

=head2 servo($pin_num)

This method configures PWM clock and divisor to operate a typical 50Hz servo,
and returns a special L<RPi::Pin> object. These servos have a C<left> pulse of
C<50>, a C<centre> pulse of C<150> and a C<right> pulse of C<250>. On exit of
the program (or a crash), we automatically clean everything up properly.

Parameters:

lib/RPi/WiringPi/FAQ.pod  view on Meta::CPAN

=head2 Serial configuration

In order to use GPIO pins 14 and 15 as a serial interface on the Raspberry Pi,
you need to disable the built-in Bluetooth adaptor. This distribution's  serial
functionality will not operate correctly without this being done.

First, in C<raspi-config>, in the C<Serial> section in C<Interfacing Options>,
disable "login shell" on the serial interface, then disable Bluetooth by editing
the C</boot/config.txt>, and add the following line:

    dtoverlay=pi3-disable-bt-overlay

Save the file, then reboot the Pi.

=head1 PI

=head2 Create a Raspberry Pi object

First thing that needs doing is some back-end Pi configuration. We take care of
that automatically during the Raspberry Pi object creation. Upon instantiation,
we set the system to use the GPIO pin numbering scheme.

lib/RPi/WiringPi/FAQ.pod  view on Meta::CPAN

    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 simply returns the information from the C<ifconfig> system call.

=head3 File system information

    say $pi->file_system;

lib/RPi/WiringPi/FAQ.pod  view on Meta::CPAN

    $device->write_block([1, 2, 3, 4]);

=head1 SERIAL BUS

Allows you to perform basic read and write operations on a standard serial
interface using the L<RPi::Serial> library. See that documentation for full
usage information.

=head2 Note

Bluetooth on the Pi overlays the serial pins (14, 15) on the Pi. To use
serial, you must disable bluetooth in the C</boot/config.txt> file:

    dtoverlay=pi3-disable-bt-overlay

=head2 Usage

    my $dev  = "/dev/ttyS0";
    my $baud = 115200;

    my $ser = $pi->serial($dev, $baud);

    $ser->putc(5);

lib/RPi/WiringPi/FAQ.pod  view on Meta::CPAN

between the Tx and Rx pins, and:

    export RPI_SERIAL=1

These tests will skip by default otherwise.

Note that you must enable serial in C<raspi-config>, disable "terminal over
serial", and then reboot after adding the following line in the
C</boot/config.txt> file (this disabled Bluetooth on the Serial interface):

    dtoverlay=pi3-disable-bt-overlay

=head3 BMP Barometric Pressure Sensor Testing

To test the temperature and barometric pressure from the BMPx80 sensors:

    export RPI_BMP=1

These tests skip by default.

=head3 HCSR04 Ultrasonic Testing

t/404-sysinfo_raspi_config.t  view on Meta::CPAN

if (! $ENV{PI_BOARD}){
    plan skip_all => "Not on a Pi board";
}

my $pi = RPi::WiringPi->new;

like $pi->raspi_config, qr/core_freq/, "method includes data ok";

like
    $pi->raspi_config,
    qr/dtoverlay=pi3-disable-bt-overlay/,
    "...and custom changes are included";

done_testing();



( run in 0.780 second using v1.01-cache-2.11-cpan-49f99fa48dc )