LCD implementation of our project.
Dependencies: mbed mbed-rtos MLX90614
Diff: Compass.cpp
- Revision:
- 7:11675c1dce4f
- Parent:
- 5:5b1a8ad6c187
- Child:
- 8:81ed1135ba02
--- a/Compass.cpp Sat May 30 14:58:44 2015 +0000 +++ b/Compass.cpp Wed Jun 03 12:22:46 2015 +0000 @@ -29,11 +29,15 @@ void Compass::compass_update() { ct->signal_wait(START_THREAD); - - int i = 0; + initSensors(); + + SensorState_t state; //get degrees from other functions and display the compass while(true) { - draw_compass(i++); + #ifdef LSM303_on + LSM303(&state); + #endif + draw_compass(state.heading - 33 + 90); //offset Thread::wait(30); st7565->clear(); } @@ -110,7 +114,7 @@ //display degrees and radians in bottom left corner char s_deg[10], s_rad[10]; - sprintf(s_deg, "DEG:%g", degrees); + sprintf(s_deg, "DEG:%0.2g", degrees); sprintf(s_rad, "RAD:%.2g", rad); st7565->drawstring(1, 6, s_deg); st7565->drawstring(1, 7, s_rad);