![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
test bmp085,mpxv7002dp
Dependencies: BMP085_2 GPS mbed
Fork of HelloBMP085 by
main.cpp@0:4c7cde980426, 2013-07-29 (annotated)
- Committer:
- TakashiSasaki
- Date:
- Mon Jul 29 07:53:31 2013 +0000
- Revision:
- 0:4c7cde980426
- Child:
- 3:3ffa19319516
I2C communication with BMP085 by p27 and p28.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
TakashiSasaki | 0:4c7cde980426 | 1 | #include "mbed.h" |
TakashiSasaki | 0:4c7cde980426 | 2 | #include "BMP085.h" |
TakashiSasaki | 0:4c7cde980426 | 3 | |
TakashiSasaki | 0:4c7cde980426 | 4 | DigitalOut myled(LED1); |
TakashiSasaki | 0:4c7cde980426 | 5 | BMP085 bmp085(p28, p27); |
TakashiSasaki | 0:4c7cde980426 | 6 | Serial pc(USBTX, USBRX); |
TakashiSasaki | 0:4c7cde980426 | 7 | |
TakashiSasaki | 0:4c7cde980426 | 8 | int main() { |
TakashiSasaki | 0:4c7cde980426 | 9 | pc.printf("main\n"); |
TakashiSasaki | 0:4c7cde980426 | 10 | float p, t; |
TakashiSasaki | 0:4c7cde980426 | 11 | |
TakashiSasaki | 0:4c7cde980426 | 12 | while(1) { |
TakashiSasaki | 0:4c7cde980426 | 13 | myled = 1; |
TakashiSasaki | 0:4c7cde980426 | 14 | bmp085.update(); |
TakashiSasaki | 0:4c7cde980426 | 15 | p = bmp085.get_pressure(); |
TakashiSasaki | 0:4c7cde980426 | 16 | t = bmp085.get_temperature(); |
TakashiSasaki | 0:4c7cde980426 | 17 | pc.printf("P %6.2f t %6.2f\n", p, t); |
TakashiSasaki | 0:4c7cde980426 | 18 | myled = 0; |
TakashiSasaki | 0:4c7cde980426 | 19 | wait(3); |
TakashiSasaki | 0:4c7cde980426 | 20 | }//while |
TakashiSasaki | 0:4c7cde980426 | 21 | }//main |