Seed Barometer with I2C interface, NOT working with Seed Arch BLE. Need help.

Dependencies:   BMP085 mbed-src

Fork of Seeed_Barometer_Sensor_Example by Seeed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 
00002 #include "mbed.h"
00003 #include "BMP085.h"
00004 
00005 // this little program onlu works with the modified mbed-src, 
00006 // see https://developer.mbed.org/questions/5107/Arch-BLE-I2C-working/#answer5390
00007 
00008 int main(void)
00009 {
00010     printf("Creating i2c interface  ...\r\n");
00011     I2C ic(p29, p28); // I2C (pin sda, pin slc)
00012     printf("Creating barometer interface  ...\r\n");
00013     BMP085 barometer(ic, BMP085_oss1);
00014 
00015     float p = 0.0f, t = 0.0f;
00016 
00017     printf("Entering main loop  ...\r\n");
00018     while(1) {
00019         barometer.update();
00020         p = barometer.get_pressure();
00021         t = barometer.get_temperature();
00022         printf("Pressure: %6.2f Temperature(c): %6.2f Temperature(F): %6.2f\r\n", p, t, 32 + t * 1.8f);
00023         wait(1.0f);
00024     }
00025 }