Rémi Jourdain
/
I2CBMPRedbear
I2CBMPREdBear
main.cpp@0:678a145039d1, 2015-09-24 (annotated)
- Committer:
- Remitte
- Date:
- Thu Sep 24 15:04:36 2015 +0000
- Revision:
- 0:678a145039d1
I2C BMP 085 Red Bear
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Remitte | 0:678a145039d1 | 1 | #include "mbed.h" |
Remitte | 0:678a145039d1 | 2 | #include "BMP085.h" |
Remitte | 0:678a145039d1 | 3 | |
Remitte | 0:678a145039d1 | 4 | BMP085 bmp085(P0_29, P0_28); |
Remitte | 0:678a145039d1 | 5 | |
Remitte | 0:678a145039d1 | 6 | DigitalOut myled(LED1); |
Remitte | 0:678a145039d1 | 7 | Serial pc(USBTX, USBRX); |
Remitte | 0:678a145039d1 | 8 | |
Remitte | 0:678a145039d1 | 9 | int main() { |
Remitte | 0:678a145039d1 | 10 | float p, t; |
Remitte | 0:678a145039d1 | 11 | |
Remitte | 0:678a145039d1 | 12 | while(1) { |
Remitte | 0:678a145039d1 | 13 | myled = 1; |
Remitte | 0:678a145039d1 | 14 | |
Remitte | 0:678a145039d1 | 15 | bmp085.update(); |
Remitte | 0:678a145039d1 | 16 | p = bmp085.get_pressure(); |
Remitte | 0:678a145039d1 | 17 | t = bmp085.get_temperature(); |
Remitte | 0:678a145039d1 | 18 | pc.printf("p:%6.2f hPa / t:%6.2f C\n", p, t); |
Remitte | 0:678a145039d1 | 19 | |
Remitte | 0:678a145039d1 | 20 | myled = 0; |
Remitte | 0:678a145039d1 | 21 | wait(3); |
Remitte | 0:678a145039d1 | 22 | } |
Remitte | 0:678a145039d1 | 23 | } |