Laser Sensing Display for UI interfaces in the real world
Fork of skinGames_forktest by
Diff: main.cpp
- Revision:
- 23:bf666fcc61bc
- Parent:
- 22:d87317d7ca91
- Child:
- 24:4e52031a495b
--- a/main.cpp Sat Jun 02 06:38:12 2012 +0000 +++ b/main.cpp Wed Jun 13 10:09:41 2012 +0000 @@ -12,7 +12,7 @@ // For tests: DigitalOut myled(LED1); DigitalOut myled2(LED2); -//DigitalOut myled3(LED2); +DigitalOut myled3(LED3); // To test the time it takes for executing one loop in the main program: @@ -165,7 +165,7 @@ blobconf.sendConfData(); - lsr.startFullDisplay(); // this start the point-display counter (wherever the actual laser is). Before update and draw, the counter needs to be reset. + lsr.startFullDisplay(); // this start the point-display counter (wherever the actual laser is). Before update and draw, the counter needs to be reset. // __enable_irq(); @@ -279,6 +279,44 @@ else IO.setGreenPower(1); } } + + else if ( !strcmp(address[0], "testPower" ) ) { + // First, we need to disable the threaded display for the loop: + timerForRendering.detach(); + + // Note: arguments is first 3 bits to set the laser powers (3 LSB bits to set each color) + // and then the second argument is the number of seconds to wait for the measurment + int value1=data[0], value2=data[1]; + if ((value1!=-1)&&(value2!=-1)) { // otherwise do nothing, this is a reception error (there was no data) + + // Set position of mirrors: + IO.writeOutX(CENTER_AD_MIRROR_X); + IO.writeOutY(CENTER_AD_MIRROR_Y); + + for (int i=0; i<3 ; i++) { + myled3 = 1; + wait(0.2); + myled3 = 0; + wait(0.2); + } + + // Set laser power: + IO.setRGBPower((unsigned char)value1); + + // Wait... + wait(value2);// in seconds + //Timer t; + //t.start(); + //while(t.read_ms()<value2*1000); + //t.stop(); + } + + // Finally, start again threaded display: + timerForRendering.attach(&lsr, &simpleLaserSensingRenderer::laserRenderThread, RENDER_INTERVAL); + + } + + // SIMPLE BEHAVIOUR MODES (to be read from an XML file in the future): else if (!strcmp(address[0], "elastic_following")) { //