Laser Sensing Display for UI interfaces in the real world

Dependencies:   mbed

Fork of skinGames_forktest by Alvaro Cassinelli

Revision:
22:d87317d7ca91
Parent:
21:bc9b9383f4b6
Child:
23:bf666fcc61bc
--- a/main.cpp	Sun May 06 14:40:19 2012 +0000
+++ b/main.cpp	Sat Jun 02 06:38:12 2012 +0000
@@ -250,6 +250,15 @@
     }
 
     else if ( !strcmp(address[0], "mbedReset" ) ) mbed_reset();
+    
+    else if (!strcmp(address[0], "showMirrorLimits")) {
+        int value=data[0];
+        if (value!=-1) { // otherwise do nothing, this is a reception error (there was no data)
+          timerForRendering.detach();
+               IO.showLimitsMirrors(value);
+          timerForRendering.attach(&lsr, &simpleLaserSensingRenderer::laserRenderThread, RENDER_INTERVAL);     
+             }
+       }
 
     else if ( !strcmp(address[0], "calibrate" ) ) {
         // First, we need to disable the threaded display for the loop:
@@ -307,6 +316,12 @@
             // blobconf.computeBoundingBox();
             blobconf.clearConfig();
 
+            // HACK for the time being: 
+            int aux=rand()%100;
+           if (aux<70) value=1; 
+           else if (aux<80) value=2; 
+           else value=3;
+
             for (int i=0; i<value ; i++) blobconf.addOneRigidLoopBouncing();
 
             lsr.setConfigToRender(&blobconf);
@@ -322,7 +337,16 @@
             timerForRendering.detach();
             // blobconf.computeBoundingBox();
             blobconf.clearConfig();
+            
+           // HACK for the time being: 
+           int aux=rand()%100;
+           if (aux<70) value=1; 
+           else if (aux<80) value=2; 
+           else value=6;
+            
             for (int i=0; i<value ; i++) blobconf.addOneRigidLoopFollowing();
+            
+            
             lsr.setConfigToRender(&blobconf);
             timerForRendering.attach(&lsr, &simpleLaserSensingRenderer::laserRenderThread, RENDER_INTERVAL);
             // timerForRendering.attach(&lsr, &simpleLaserSensingRenderer::laserRenderThreadONEBLOBONLY, RENDER_INTERVAL);