Test of the BMP180 sensor (Temperature and pression) with the nRF51822 platform.
Fork of BMP180_example by
Diff: main.cpp
- Revision:
- 3:43e6a2416ddf
- Parent:
- 0:f03b6a07c4ba
diff -r 20c4b5932337 -r 43e6a2416ddf main.cpp --- a/main.cpp Fri Apr 17 15:48:08 2015 +0000 +++ b/main.cpp Fri Oct 16 14:53:16 2015 +0000 @@ -2,16 +2,16 @@ #include "mbed.h" #include "BMP180.h" -I2C i2c(I2C_SDA, I2C_SCL); +I2C i2c(D14, D15); BMP180 bmp180(&i2c); int main(void) { while(1) { if (bmp180.init() != 0) { - printf("Error communicating with BMP180\n"); + printf("Error communicating with BMP180\r\n"); } else { - printf("Initialized BMP180\n"); + printf("Initialized BMP180\r\n"); break; } wait(1); @@ -22,7 +22,7 @@ wait_ms(5); // Wait for conversion to complete float temp; if(bmp180.getTemperature(&temp) != 0) { - printf("Error getting temperature\n"); + printf("Error getting temperature\r\n"); continue; } @@ -30,11 +30,11 @@ wait_ms(10); // Wait for conversion to complete int pressure; if(bmp180.getPressure(&pressure) != 0) { - printf("Error getting pressure\n"); + printf("Error getting pressure\r\n"); continue; } - printf("Pressure = %d Pa Temperature = %f C\n", pressure, temp); + printf("Pressure = %d Pa Temperature = %f C\r\n", pressure, temp); wait(1); } } \ No newline at end of file