SkipperS2v2 and bmp

Dependencies:   BMP280 mpu9250forskipper mbed

Revision:
1:5c8e961811d1
Parent:
0:e6b1cd3646df
Child:
2:c1c7afb86416
--- a/main.cpp	Mon Aug 15 04:38:29 2016 +0000
+++ b/main.cpp	Mon Aug 15 10:07:24 2016 +0000
@@ -1,16 +1,24 @@
 #include "mbed.h"
 #include "MPU9250.h"
+#include "BMP280.h"
+
+#define bmpadr 0x76<<1 // SD0 pulldown 0x76<<1  , pullup 0x77<<1
+
+//I2C SDA,SCL:  PC_9, PA_8
 
 SPI spi(PC_12, PC_11, PC_10); // mosi, miso, sclk
 DigitalOut cs(PA_15);
-Serial pc(PA_9,PA_10);
+Serial pc(PA_2,PA_3);  //v2
+//Serial pc(PA_9,PA_10);   //original
 
 float sum = 0;
 uint32_t sumCount = 0;
 MPU9250 mpu9250;
+BMP280 bmp(PC_9, PA_8 ,bmpadr);    //(PinName sda, PinName scl, char slave_adr)
 Timer t;
 
 int main() {
+    wait(2);
     pc.baud(9600);
     //a8=0;
     //c9=0;
@@ -44,6 +52,13 @@
   
   t.start();        
   
+  //BMP initialize
+  bmp.initialize();
+  
+  while(1){
+      pc.printf("TEM : %f, PRE : %f\n",bmp.getTemperature(),bmp.getPressure());
+      wait_ms(500);
+  }
   
     
   // Read the WHO_AM_I register, this is a good test of communication
@@ -146,9 +161,9 @@
     //pc.printf(" ay = %f", 1000*ay); 
     //pc.printf(" az = %f  mg\n\r", 1000*az); 
 
-    pc.printf("gx = %f", gx); 
-    pc.printf(" gy = %f", gy); 
-    pc.printf(" gz = %f  deg/s\n\r", gz); 
+    //pc.printf("gx = %f", gx); 
+    //pc.printf(" gy = %f", gy); 
+    //pc.printf(" gz = %f  deg/s\n\r", gz); 
     
     //pc.printf("gx = %f", mx); 
     //pc.printf(" gy = %f", my); 
@@ -181,7 +196,7 @@
     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);
  
     myled= !myled;