|
While playing with the BMP 180 I have managed to make it to work, but not the way it should. Added two lines to /etc/module bmp280-i2c and bm280, and added an entry in init.d and with a link to rc5.d namely the file bmp180 and the link S02bmp180.
It contains :
#!/bin/sh
cd /sys/class/i2c-adapter/i2c-0/
echo "bmp180 0x77" > new_device
Having done this a simple Python script returns the pressure and temperature:
import math
pressure=open("/sys/bus/i2c/drivers/bmp280/0-0077/iio:device1/in_pressure_input","r").read()
# Correct for 150 m above sea level
P=float(pressure)*10.0*math.exp(150.0/8500.0)
print P,"hPa"
temperature=open("/sys/bus/i2c/drivers/bmp280/0-0077/iio:device1/in_temp_input","r").read()
T=float(temperature)/1000.0
print T,"\xb0C"
While this works, it not as elegant as it should have been when using a library like the BMP Adafruit library.
Ole
|
|