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

Dependencies:   mbed

Revision:
5:cea6da0fe2f0
Parent:
4:1428775752f7
--- a/laserProjectorHardware/laserProjectorHardware.cpp	Wed Dec 10 07:22:41 2014 +0000
+++ b/laserProjectorHardware/laserProjectorHardware.cpp	Wed Dec 10 08:55:56 2014 +0000
@@ -116,9 +116,10 @@
     float alpha=2*3.141592/numPoints;
     float theta=0;
     for (int i=0; i<numPoints; i++) {
-         writeOutX(X+1.0*R*cos(theta));
-         writeOutY(Y+1.0*R*sin(theta));
+         writeOutX(int(1.0*X+1.0*R*cos(theta)));
+         writeOutY(int(1.0*Y+1.0*R*sin(theta)));
          theta+=alpha;
+          wait_us(10);
         }
     }