simple example program to control one mirror from serial data

Dependencies:   mbed

Revision:
2:0548c7bf9fba
Parent:
1:daf6b4939120
diff -r daf6b4939120 -r 0548c7bf9fba main.cpp
--- a/main.cpp	Fri Sep 07 08:04:40 2012 +0000
+++ b/main.cpp	Thu Oct 04 05:14:14 2012 +0000
@@ -5,7 +5,7 @@
 
 void processSerial();
 
-unsigned int Y; // position of the mirror (note: in fact it is an ANGLE)
+unsigned int X, Y; // position of the mirror (note: in fact it is an ANGLE)
 bool newPositionReady=false;
 
 unsigned int counter=0;
@@ -55,11 +55,18 @@
       stringData[indexStringData] = val;
       indexStringData++;
     }
-    
+
   // X value?
   else if (val=='X') {
     stringData[indexStringData] = 0 ;
-   Y=atoi(stringData);
+    X=atoi(stringData);
+    indexStringData=0;
+    //newPositionReady=true;
+  }
+    // Y value?
+    else if (val=='Y') {
+    stringData[indexStringData] = 0 ;
+    Y=atoi(stringData);
     indexStringData=0;
     newPositionReady=true;
   }