![](/media/cache/profiles/68a15b5278e4f7c4c056df9d5f1d3b1f.jpg.50x50_q85.jpg)
Example controlling galvanomirrors (X and Y) using the spi DAC MCP4922 and the new platform FRDM_K64F
Revision 5:cea6da0fe2f0, committed 2014-12-10
- 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
--- 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); } }
--- 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; }