lizard leg trajectory pd control code for 2.s994

Dependencies:   QEI mbed

Files at this revision

API Documentation at this revision

Comitter:
lukeplummer
Date:
Sun Dec 01 19:37:53 2013 +0000
Parent:
6:8cd6aa47fd51
Child:
8:448376e7d8f1
Commit message:
added force logging;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun Dec 01 19:33:07 2013 +0000
+++ b/main.cpp	Sun Dec 01 19:37:53 2013 +0000
@@ -17,8 +17,8 @@
 QEI encoder2(p9, p10, NC, 1200, QEI::X4_ENCODING);
 
 //force measurement pins
-AnalogIn f1(p15);
-AnalogIn f2(p16);
+AnalogIn aIn1(p15);
+AnalogIn aIn2(p16);
 
 // Declare other objects
 Ticker ctrlTicker;                // creates an instance of the ticker class, which can be used for running functions at a specified frequency.
@@ -98,8 +98,10 @@
 }
 
 void writeFiles() {
+    float f1 = aIn1.read();
+    float f2 = aIn2.read()
     fprintf(fp1, "%f, %f\n",a1_t1, a2_t1);
-    fprintf(fp2, "%f, %f\n",f1.read(), f2.read());
+    fprintf(fp2, "%f, %f average: $f\n",f1,f2, (f1+f2)/2);
 }
 
 int main() {