SkipperS2v2 and bmp
Dependencies: BMP280 mpu9250forskipper mbed
Diff: main.cpp
- Revision:
- 2:c1c7afb86416
- Parent:
- 1:5c8e961811d1
--- a/main.cpp Mon Aug 15 10:07:24 2016 +0000 +++ b/main.cpp Mon Aug 22 02:51:01 2016 +0000 @@ -13,9 +13,11 @@ float sum = 0; uint32_t sumCount = 0; +float bmpTEM , bmpPRE; MPU9250 mpu9250; BMP280 bmp(PC_9, PA_8 ,bmpadr); //(PinName sda, PinName scl, char slave_adr) Timer t; +float PRES_first; int main() { wait(2); @@ -54,12 +56,7 @@ //BMP initialize bmp.initialize(); - - while(1){ - pc.printf("TEM : %f, PRE : %f\n",bmp.getTemperature(),bmp.getPressure()); - wait_ms(500); - } - + PRES_first = bmp.getPressure(); // Read the WHO_AM_I register, this is a good test of communication uint8_t whoami = mpu9250.readByte(MPU9250_ADDRESS, WHO_AM_I_MPU9250); // Read WHO_AM_I register for MPU-9250 @@ -96,9 +93,8 @@ { pc.printf("Could not connect to MPU9250: \n\r"); pc.printf("%#x \n", whoami); - - + while(1) ; // Loop forever if communication doesn't happen } @@ -196,8 +192,12 @@ yaw -= 13.8f; // Declination at Danville, California is 13 degrees 48 minutes and 47 seconds on 2014-04-04 roll *= 180.0f / PI; - pc.printf("Yaw, Pitch, Roll: %f %f %f \n\r", yaw, pitch, roll); + //pc.printf("Yaw, Pitch, Roll: %f %f %f \n\r", yaw, pitch, roll); //pc.printf("average rate = %f\n\r", (float) sumCount/sum); + + bmpTEM=bmp.getTemperature(); + bmpPRE=bmp.getPressure(); + pc.printf("PRE : %f\n",bmpPRE - PRES_first); myled= !myled; count = t.read_ms();