A system to help you ride your bike better than you do right now.

Dependencies:   4DGL-uLCD-SE SDFileSystem mbed LSM9DS1_Library_cal

Revision:
8:8c073046821d
Parent:
7:0d5396762696
Child:
9:53bb4c706947
--- a/main.cpp	Mon Dec 05 01:59:24 2016 +0000
+++ b/main.cpp	Mon Dec 05 02:45:17 2016 +0000
@@ -8,6 +8,8 @@
 
 #define START_S 1480719111
 
+# define PI   3.14159
+
 #define LEFT  0xA
 #define RIGHT 0xB
 #define STOP  0xC
@@ -19,6 +21,7 @@
 DigitalOut rightBlinker(p23);
 DigitalOut brakeLight(p21);
 Timer blinkT;
+
 AnalogIn flex(p15);
 LSM9DS1 imu(p9, p10, 0xD6, 0x3C);
 
@@ -57,6 +60,8 @@
     int going = 1; // cyclist is moving
     set_time(START_S);  // Set RTC time
     
+    float theta;
+    
     hallSensor.fall(&pass);
     hallT.start();     // start the hall sensor timer
     
@@ -75,13 +80,18 @@
         maxSpeed = (speed > maxSpeed) ? speed : maxSpeed;
         
         lcd.locate(0, 1);
-        lcd.color(GREEN);
+        lcd.color(BLUE);
         lcd.printf("Distance : %3.1f mi\n\n", miles);
-        lcd.color(BLUE);
+        lcd.color(GREEN);
         lcd.printf("Speed : %2.1f mph\n\n", speed);
         lcd.color(LGREY);
         lcd.printf("Time : %3.1f min\n\n", (float)seconds / 60);
         
+        lcd.circle(64, 128, 64, GREEN);
+        theta = PI - (speed / 9.536);
+        lcd.line(64, 128, 64 + 62*cos(theta), + 62*sin(theta), WHITE);
+        
+        
         // light states code
         // lightState = get_state();