Seed Barometer with I2C interface, NOT working with Seed Arch BLE. Need help.
Fork of Seeed_Barometer_Sensor_Example by
main.cpp@1:e15e9cb70711, 2014-11-02 (annotated)
- Committer:
- grassel
- Date:
- Sun Nov 02 08:35:28 2014 +0000
- Revision:
- 1:e15e9cb70711
- Parent:
- 0:8381ff08ace1
- Child:
- 2:371c934ec950
I2C with Seed Arch BLE _NOT_ working. Need help!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sam_grove | 0:8381ff08ace1 | 1 | |
sam_grove | 0:8381ff08ace1 | 2 | #include "mbed.h" |
sam_grove | 0:8381ff08ace1 | 3 | #include "BMP085.h" |
sam_grove | 0:8381ff08ace1 | 4 | |
sam_grove | 0:8381ff08ace1 | 5 | int main(void) |
sam_grove | 0:8381ff08ace1 | 6 | { |
grassel | 1:e15e9cb70711 | 7 | printf("Creating i2c interface ...\r\n"); |
grassel | 1:e15e9cb70711 | 8 | I2C ic(p5, p6); // I2C (pin sda, pin slc) |
grassel | 1:e15e9cb70711 | 9 | printf("Creating barometer interface ...\r\n"); |
grassel | 1:e15e9cb70711 | 10 | BMP085 barometer(ic, BMP085_oss1); |
grassel | 1:e15e9cb70711 | 11 | |
sam_grove | 0:8381ff08ace1 | 12 | float p = 0.0f, t = 0.0f; |
grassel | 1:e15e9cb70711 | 13 | |
grassel | 1:e15e9cb70711 | 14 | printf("Entering main loop ...\r\n"); |
sam_grove | 0:8381ff08ace1 | 15 | while(1) { |
sam_grove | 0:8381ff08ace1 | 16 | barometer.update(); |
sam_grove | 0:8381ff08ace1 | 17 | p = barometer.get_pressure(); |
sam_grove | 0:8381ff08ace1 | 18 | t = barometer.get_temperature(); |
grassel | 1:e15e9cb70711 | 19 | printf("Pressure: %6.2f Temperature(c): %6.2f Temperature(F): %6.2f\r\n", p, t, 32 + t * 1.8f); |
sam_grove | 0:8381ff08ace1 | 20 | wait(1.0f); |
sam_grove | 0:8381ff08ace1 | 21 | } |
sam_grove | 0:8381ff08ace1 | 22 | } |