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

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mbedalvaro
Date:
Wed Dec 10 08:55:56 2014 +0000
Parent:
4:1428775752f7
Commit message:
working (the points are not drawn in an interrupt). This is a very simple code communicating wiht the PC through Serial port. Note: I noticed lots of aberrations produced by the filters and amplification in the electronic mirror driver.

Changed in this revision

laserProjectorHardware/laserProjectorHardware.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 1428775752f7 -r cea6da0fe2f0 laserProjectorHardware/laserProjectorHardware.cpp
--- 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);
         }
     }
 
diff -r 1428775752f7 -r cea6da0fe2f0 main.cpp
--- a/main.cpp	Wed Dec 10 07:22:41 2014 +0000
+++ b/main.cpp	Wed Dec 10 08:55:56 2014 +0000
@@ -102,7 +102,7 @@
   else if (val=='C') {     
     stringData[indexStringData] = 0 ;
     if(atoi(stringData)>0) {
-   IO.drawCircle(2048, 2048, 1500, 1000, int(atoi(stringData)));
+   IO.drawCircle(2048, 2048, 1200, 2000, int(atoi(stringData)));
    }
     indexStringData=0;
   }