practice for PID control

Dependencies:   PID QEI USBDevice mbed

Revision:
4:adf167473520
Parent:
3:e9aeee8b41e4
Child:
5:f668eb3ee52a
--- a/main.cpp	Sat Apr 19 05:08:16 2014 +0000
+++ b/main.cpp	Fri May 02 04:36:39 2014 +0000
@@ -2,6 +2,7 @@
 #include "USBSerial.h"
 #include "QEI.h"
 #include "PID.h"
+#include "SDFileSystem.h"
 
 #define     PIDRATE 0.01
 #define     CW      0x01
@@ -17,6 +18,7 @@
 SPI         spi(P0_21, NC, P1_20);
 DigitalOut  cs(P1_23);
 
+
 Timer       timer;
 
 PID         controller(kc, ti, td, PIDRATE);
@@ -105,6 +107,7 @@
             pidsetup();
             timer.reset();
             timer.start();
+            vcom.printf("%d,%d,%f\n" , timer.read_ms(), dac.bit.D, rps);
         }
 
         i++;
@@ -236,6 +239,17 @@
 //    tmp[0] = strtof(str, &erstr);
     controller.setInterval(PIDRATE);
     vcom.printf("\033[2J");
+    vcom.printf("\033[%d;%dH", 0, 0);
+    vcom.printf("Make a logfile by name of the \" hoge.csv \"\n");
+    vcom.printf("Push the boot switch to start PID control.");
+    
+    while(SW == 1){};
+    wait(0.1);
+    while(SW == 0){};
+    
+    vcom.printf("\033[2J");
+    vcom.printf("\033[%d;%dH", 0, 0);
+