BMP085 + Raspberry Pi

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Locked
dronshaw
 
Posts: 3
Joined: Thu Feb 28, 2013 11:37 pm

BMP085 + Raspberry Pi

Post by dronshaw »

Hey all...I'm new to python programming and the raspberry pi. I've got my BMP085 hooked up correctly to read sensor measurements. Right now, I've got this in a loop, but I'm trying to find an If True: statement that I could use on the BMP085 to determine if it goes into the measurement loop.

For example, the adafruit ultimate GPS guide utilizes the following:

Code: Select all

if report['class'] == 'TPV':
and then grabs the info if that is true. I'd like to find something for the BMP085 but haven't been able to find a relevant statement for it.

Hope this makes sense, thanks.

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: BMP085 + Raspberry Pi

Post by adafruit_support_mike »

The GPS code doesn't talk to the sensor directly. There's another program running on the RasPi that handles all the device communication and data formatting (it's called 'gpsd'). The example code doesn't even talk to that directly.. it calls a library that talks to gpsd and wraps the results up in a python class. The example code looks at the class it got from the library to decide what results the library got from gpsd, which in turn depend on what the gpsd's code got from the actual sensor.

The BMP085 code doesn't have all those middlemen. It talks directly to the sensor (which is much simpler than a GPS device)

So.. you don't need an "okay, the sensor is ready to give you good data" test before calling the BMP085 functions.

dronshaw
 
Posts: 3
Joined: Thu Feb 28, 2013 11:37 pm

Re: BMP085 + Raspberry Pi

Post by dronshaw »

Ahhh thank you for explaining that. I've got one loop that directly calls a plethora of sensors, cameras, and gps chips. I was wanting to "error proof" my code, so that if one of these elements fails the loop would accommodate that. This definitely help me out in understanding how the sensor interfaces witht he Pi. Thanks!

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: BMP085 + Raspberry Pi

Post by adafruit_support_mike »

That's a good strategy. I don't think the BP085 will give you any errors that would kill the program though.

Locked
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Return to “Adafruit Raspberry Pi® accessories”