code of robot bike

Dependencies:   SDFileSystem mbed

Fork of Robot_Bicycle by Chris LU

Revision:
6:bd469c945e41
Parent:
5:2290732b2782
Child:
7:b8413464d111
--- a/main.cpp	Wed Jul 06 13:22:03 2016 +0000
+++ b/main.cpp	Sun Jul 10 06:23:02 2016 +0000
@@ -1,4 +1,5 @@
 #include "mbed.h"
+#include "SDFileSystem.h"
 
 #include "RobotServo.h"
 #include "SensorFusion.h"
@@ -49,7 +50,7 @@
 
 Serial BT(PC_6, PA_12);
 
-SPI SD_card(PC_12, PC_11, PC_10);
+SDFileSystem SD_card(PC_12, PC_11, PC_10, PD_2, "sd");  //mosi, miso, sck, cs, name
 
 //**** Variables from Arduino ****//
 int counter = 0;
@@ -103,7 +104,7 @@
     timer1.attach_us(&timer1_interrupt, 4000);//4.0ms interrupt period (250 Hz)
     timer2.attach_us(&timer2_interrupt, 4098);//4.098ms interrupt period (244 Hz)
     
-    SD_card.format(8, 3);
+//    SD_card.format(8, 3);
 //    fprintf_data(0);
     pc.printf("System ready.\r\n");
     
@@ -118,7 +119,7 @@
             BTCharR = BT.getc();
             switch(BTCharR)
             {
-                case 's': reset_offset();
+                case 's': //reset_offset();
                           ready_to_go();
                           pc.printf("go\r\n");
                           pedal_state = 1; sys_state = L_PD; gamma_ref = 0.0;