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

Dependencies:   4DGL-uLCD-SE SDFileSystem mbed LSM9DS1_Library_cal

Revision:
2:d08643ff3c62
Parent:
1:9d3f2e86392e
Child:
3:26e0c0d7984f
--- a/main.cpp	Fri Dec 02 22:37:58 2016 +0000
+++ b/main.cpp	Fri Dec 02 23:03:00 2016 +0000
@@ -1,6 +1,6 @@
 #include "mbed.h"
 #include "SDFileSystem.h"
-#include "uLCD_4GDL.h"
+#include "uLCD_4DGL.h"
 
 DigitalOut myled(LED1);
 
@@ -10,24 +10,29 @@
 float distance;
 float speed;
 float maxSpeed;
+time_t start = 1480719111;
 
 int main() {
+    set_time(start);  // Set RTC time
     
     // open the file for reading and appending records
     
-    
     // recall last trip
     recall_trip(&fp);
     wait(10);
     lcd.cls();
     
     // normal operation loop here
+    while(true) {
+        time_t current = time(NULL);
+        
     // check current speed
     // check curret distance
     // check time so far
     // display this on the screen
     // check if braking, turning left or right
     // show that on the screen
+    }
     
     // store this trip
     lcd.cls();
@@ -39,8 +44,15 @@
 }
 
 void store_trip(FILE * fp) {
+    
+    FILE *fp = fopen("/sd/records/recent.txt", "w");
+    
     // write trip results to the SD card
     if (fp == NULL) {
+        lcd.locate(0, 1);
+        lcd.printf("Could not open file for write\n");
+    } else {
+        fprintf(fp, "%d %d %d", 
         
     }
 }