The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

RPi::BMP180 - Interface to the BMP180 barometric pressure sensor

SYNOPSIS

use RPi::BMP180;

my $base = 300;

my $bmp = RPi::BMP180($base);

my $f = $bmp->temp;
my $c = $bmp->temp('c');
my $p = $bmp->pressure; # kPa

DESCRIPTION

This module allows you to interface with a BMP180 barometric and temperature sensor.

METHODS

new($pin_base)

Returns a new RPi::BMP180 object.

Parameters:

$pin_base

Mandatory: Integer, the number at which to start the 'pseudo' GPIO pins for communication to the sensor. Anything above the highest numbered GPIO pin will do. For example, 100 or 200.

temp

Fetches the temperature from the sensor.

Parameters:

$want

Optional: String. By default, we return Farenheit. To get Celcius, pass in 'c'.

Returns a floating point number.

pressure

Fetches the barometric pressure in kPa.

Takes no parameters, returns a floating point number.

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.