Alvaro Cassinelli
/
laserScannerControl_FRDMK64F
Example controlling galvanomirrors (X and Y) using the spi DAC MCP4922 and the new platform FRDM_K64F
Diff: main.cpp
- Revision:
- 4:1428775752f7
- Parent:
- 3:89f592efbe84
- Child:
- 5:cea6da0fe2f0
--- a/main.cpp Wed Jun 04 09:47:04 2014 +0000 +++ b/main.cpp Wed Dec 10 07:22:41 2014 +0000 @@ -7,7 +7,7 @@ unsigned int X, Y; // position of the mirrors (note: in fact, azimuth and elevation) bool newPositionReady=false; - +bool handshakeMode=true; unsigned long counter=0; int main() { @@ -55,7 +55,6 @@ while(pc.readable()>0) { - char val =pc.getc(); // Save ASCII numeric characters (ASCII 0 - 9) on stringData: @@ -78,6 +77,13 @@ Y=atoi(stringData); indexStringData=0; newPositionReady=true; + if (handshakeMode) pc.putc('A');// send acknowledgement of correctly received position: + } + + else if (val=='H') { // this sets handshake mode to ON or OFF: + stringData[indexStringData] = 0 ; + if(atoi(stringData)>0) handshakeMode=true; else handshakeMode=false; + indexStringData=0; } else if (val=='L') { @@ -92,6 +98,14 @@ IO.showLimitsMirrors(int(atoi(stringData))); indexStringData=0; } + + else if (val=='C') { + stringData[indexStringData] = 0 ; + if(atoi(stringData)>0) { + IO.drawCircle(2048, 2048, 1500, 1000, int(atoi(stringData))); + } + indexStringData=0; + } } } \ No newline at end of file