LE KICKASS TEAM / Mbed 2 deprecated RTOS_Lights_Master

Dependencies:   mbed-rtos mbed

Revision:
3:25eba54bace2
Parent:
2:f3ae10decc2f
Child:
4:b3c3bca604a6
diff -r f3ae10decc2f -r 25eba54bace2 main.cpp
--- a/main.cpp	Sun Dec 06 22:42:01 2015 +0000
+++ b/main.cpp	Tue Dec 08 00:21:22 2015 +0000
@@ -118,11 +118,6 @@
     RgbInit();
     testRGB();
     
-    /*terminal.printf("Initializing tasks............");
-    Thread js_update(test);
-    js_update.set_priority(osPriorityNormal);
-    terminal.printf("done.");
-    newline();*/
     terminal.printf("Initializing timers..........");
     // timer responsible for updating the LEDs
     RtosTimer refresh_timer(LEDPush, osTimerPeriodic, (void *)0);
@@ -365,27 +360,31 @@
         return;
     }
     // left : R
-    if(!(joystick[1] & !joystick[3])) {
+    if(!(joystick[3])) {
         if(R.read() == 0.0)
             r = 1.0;
         r = r - .02;
     }
     // right : B
-    else if(!(joystick[2] & !joystick[4])) {
+    if(!(joystick[2])) {
         if(B.read() == 0.0)
             b = 1.0;
         b = b - .02;
     }
     // up : G
-    else if(!(joystick[1] & joystick[2])) {
+    if(!(joystick[4])) {
         if(G.read() == 0.0)
             g = 1.0;
         g = g - .02;
     }
+    // down : Reset
+    if(!(joystick[1])) {
+        r = 1.0; g = 1.0; b = 1.0;
+    }
     // center : confirm changes
-    else if(!joystick[0]) {
+    if(!joystick[0]) {
         RGBPush();
-        terminal.printf("RGB updated: (%f, %f, %f)", R.read(), G.read(), B.read());
+        terminal.printf("RGB updated: (%3.2f, %3.2f, %3.2f)", ((1 - R.read())*100), ((1 - G.read())*100), ((1 - B.read())*100));
         newline();
     }
 }