NAME
RPi::PIGPIO::Device::BMP180 - Read temperature and atmospheric pressure from a BMP180 sensor
DESCRIPTION
Uses the pigpiod to read temperature and atmospheric pressure from a BMP180 sensor
SYNOPSIS
use RPi::PIGPIO;
use RPi::PIGPIO::Device::BMP180;
my $pi = RPi::PIGPIO->connect('192.168.1.10');
my $bmp180 = RPi::PIGPIO::Device::BMP180->new($pi,1);
$bmp180->read_sensor(); #trigger a read
print "Temperature : ".$bmp180->temperature." C\n";
print "Presure : ".$bmp180->presure." mbar\n";
METHODS
new
Create a new object
Usage:
my $bmp180 = RPi::PIGPIO::Device::BMP180->new($pi,$spi,$address);
Arguments:
$pi - an instance of RPi::PIGPIO
$spi - SPI to which the sensor is connected (defaults to 1)
$address - address of the sensor (defaults to 0x77)
read_sensor
Trigger a read from the sensor. You need to call this method whenever you want to get the latest values
Usage :
$bmp180->read_sensor();
print "Presure : ".$bmp180->presure()." mbar";
pressure
Returns the atmospheric pressure in mbar
temperature
Returns the temperature in C
chip_id
Returns the chip id
chip_version
Returns the chip version
PRIVATE METHODS
compile_calibration_info
Return an signed int from after putting together 2 consecutive values from the calibration data
compile_unsigned_calibration_info
Return an unsigned int from after putting together 2 consecutive values from the calibration data
ensure_c_long
Make sure the given number is a C signed long value (32 bit)
ensure_c_short
Make sure the given number is a C signed short value (16 bit)