silabs-abakurs
/
Barometer-Example
Example program for the BMP085.
Revision 0:bcb1988de877, committed 2015-11-15
- Comitter:
- asmellby
- Date:
- Sun Nov 15 18:05:54 2015 +0000
- Commit message:
- Barometer example.;
Changed in this revision
diff -r 000000000000 -r bcb1988de877 BMP085.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BMP085.lib Sun Nov 15 18:05:54 2015 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/teams/silabs-abakurs/code/BMP085/#fb197da45ba8
diff -r 000000000000 -r bcb1988de877 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Nov 15 18:05:54 2015 +0000 @@ -0,0 +1,22 @@ +#include "BMP085.h" + +LowPowerTicker ticker; + +bool do_measurement = false; +void measurement() { + do_measurement = true; +} + +int main() { + BMP085 sensor(PD6, PD7, BMP085_MODE_HIGH_RESOLUTION); + ticker.attach(&measurement, 0.4); + + while(1) { + sleep(); + if(do_measurement) { + do_measurement = false; + sensor.measure(); + printf("T: %6.2f, P: %6.4f\r\n ", sensor.get_temperature(), sensor.get_pressure()); + } + } +} \ No newline at end of file
diff -r 000000000000 -r bcb1988de877 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Nov 15 18:05:54 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11 \ No newline at end of file