Example controlling galvanomirrors (X and Y) using the spi DAC MCP4922 and the new platform FRDM_K64F

Dependencies:   mbed

Revision:
2:383b2acec6e4
Parent:
1:4be6abc4ed43
Child:
3:89f592efbe84
--- a/main.cpp	Sun May 25 12:24:21 2014 +0000
+++ b/main.cpp	Mon May 26 08:37:38 2014 +0000
@@ -8,6 +8,8 @@
 unsigned int X, Y; // position of the mirrors (note: in fact, azimuth and elevation)
 bool newPositionReady=false;
 
+unsigned long counter=0;
+
 int main() {
 
     // SETUP: --------------------------------------------------------------------------------------------
@@ -32,9 +34,18 @@
    //  myled=1;IO.setRedPower(0);
    //  wait_ms(1000); 
    
+  // Y = CENTER_AD_MIRROR_X+1000*cos(1.0*counter/10);
+//    X = CENTER_AD_MIRROR_Y+800*sin(1.0*counter/15);
+//    IO.writeOutXY(X,Y);
+// counter++;
+   
+   
+   //IO.drawCircle(X, Y, 1000, 200);
+   
         processSerial();
         if (newPositionReady) {
-            IO.writeOutXY(X,Y);
+          IO.writeOutXY(X,Y);
+          //IO.drawCircle(X, Y, 1000, 20);
             newPositionReady=false;
         }
     }
@@ -80,5 +91,11 @@
     indexStringData=0;
   }
  
+  else if (val=='S') {     
+    stringData[indexStringData] = 0 ;
+   IO.showLimitsMirrors(int(atoi(stringData)));
+    indexStringData=0;
+  }
+ 
  }
 }
\ No newline at end of file