BMP085
Dependencies: BMP085_2 TextLCD mbed
Fork of HelloBMP085 by
main.cpp@3:773bc12a9271, 2016-02-29 (annotated)
- Committer:
- Tuxitheone
- Date:
- Mon Feb 29 19:00:08 2016 +0000
- Revision:
- 3:773bc12a9271
- Parent:
- 0:4c7cde980426
BMP085
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" |
Tuxitheone | 3:773bc12a9271 | 3 | #include "TextLCD.h" |
TakashiSasaki | 0:4c7cde980426 | 4 | |
Tuxitheone | 3:773bc12a9271 | 5 | DigitalOut myled1(LED1); |
Tuxitheone | 3:773bc12a9271 | 6 | DigitalOut myled4(LED4); |
Tuxitheone | 3:773bc12a9271 | 7 | BMP085 bmp085(p9, p10); |
TakashiSasaki | 0:4c7cde980426 | 8 | Serial pc(USBTX, USBRX); |
Tuxitheone | 3:773bc12a9271 | 9 | TextLCD LCD(p15, p16, p17, p18, p19, p20,TextLCD::LCD20x4); // rs, e, d4-d7 |
Tuxitheone | 3:773bc12a9271 | 10 | |
Tuxitheone | 3:773bc12a9271 | 11 | int main() |
Tuxitheone | 3:773bc12a9271 | 12 | { |
Tuxitheone | 3:773bc12a9271 | 13 | pc.printf("main\n\r"); |
TakashiSasaki | 0:4c7cde980426 | 14 | float p, t; |
Tuxitheone | 3:773bc12a9271 | 15 | |
TakashiSasaki | 0:4c7cde980426 | 16 | while(1) { |
Tuxitheone | 3:773bc12a9271 | 17 | LCD.cls(); |
Tuxitheone | 3:773bc12a9271 | 18 | myled1 = 1; |
Tuxitheone | 3:773bc12a9271 | 19 | myled4 = 0; |
TakashiSasaki | 0:4c7cde980426 | 20 | bmp085.update(); |
TakashiSasaki | 0:4c7cde980426 | 21 | p = bmp085.get_pressure(); |
TakashiSasaki | 0:4c7cde980426 | 22 | t = bmp085.get_temperature(); |
Tuxitheone | 3:773bc12a9271 | 23 | // pc.printf("Pressure %6.2f - Temperature %6.2f\n\r", p, t); |
Tuxitheone | 3:773bc12a9271 | 24 | LCD.printf("Pressure %6.2f\n", p/1000-1); |
Tuxitheone | 3:773bc12a9271 | 25 | LCD.printf("In Temp %6.2f\n", t); |
Tuxitheone | 3:773bc12a9271 | 26 | myled1 = 0; |
Tuxitheone | 3:773bc12a9271 | 27 | myled4 = 1; |
Tuxitheone | 3:773bc12a9271 | 28 | wait(1.0); |
Tuxitheone | 3:773bc12a9271 | 29 | } |
Tuxitheone | 3:773bc12a9271 | 30 | } |