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

main.cpp

Committer:
grassel
Date:
2014-11-04
Revision:
5:f3e52a564ea7
Parent:
4:fb3edb8a479c

File content as of revision 5:f3e52a564ea7:


#include "mbed.h"
#include "BMP085.h"

// this little program onlu works with the modified mbed-src, 
// see https://developer.mbed.org/questions/5107/Arch-BLE-I2C-working/#answer5390

int main(void)
{
    printf("Creating i2c interface  ...\r\n");
    I2C ic(p29, p28); // I2C (pin sda, pin slc)
    printf("Creating barometer interface  ...\r\n");
    BMP085 barometer(ic, BMP085_oss1);

    float p = 0.0f, t = 0.0f;

    printf("Entering main loop  ...\r\n");
    while(1) {
        barometer.update();
        p = barometer.get_pressure();
        t = barometer.get_temperature();
        printf("Pressure: %6.2f Temperature(c): %6.2f Temperature(F): %6.2f\r\n", p, t, 32 + t * 1.8f);
        wait(1.0f);
    }
}