FIBO
/
ReadingMag_HMC5883L_work
test module for fibo
Fork of ReadingMag_HMC5883L by
Diff: main.cpp
- Revision:
- 1:ed9abb368fcf
- Parent:
- 0:6bc5f85ca6fa
--- a/main.cpp Tue May 21 13:48:10 2013 +0000 +++ b/main.cpp Mon Mar 02 09:06:19 2015 +0000 @@ -1,20 +1,23 @@ #include "mbed.h" #include "HMC5883L.h" - +#include "ms5611.h" #include <math.h> -#define SDA p9 -#define SCL p10 +#define SDA PB_9 +#define SCL PB_8 #define PI 3.14159265 int main() { float x, y, z, heading; + float p; /* float m_x, m_y, m_z; */ printf("Inicializing...\r\n"); HMC5883L hmc5883l(SDA, SCL); + ms5611 baro(SDA, SCL); + baro.cmd_reset(); //HMC5883L *hmc5883l = new HMC5883L(SDA, SCL); printf("OK...\r\n"); /* @@ -43,7 +46,7 @@ x = hmc5883l.getMx(); y = hmc5883l.getMy(); z = hmc5883l.getMz(); - + p = baro.getPressure(); heading = atan2(y, x); if(heading < 0) heading += 2*PI; @@ -63,6 +66,7 @@ printf("x: %f \t\ty: %f \t\t z: %f \t\t heading: %f \t\r\n", x, y, z, heading); + printf("pressure : %f \n",p); wait_ms(200); }