Control de led por tarjeta A en tarjeta B

Dependencies:   ProyectoARM mbed

Fork of FRDM_TSI by mbed official

Revision:
7:1e8f28b8e512
Parent:
6:843833d28602
--- a/main.cpp	Tue May 31 16:20:58 2016 +0000
+++ b/main.cpp	Wed Jun 01 00:51:19 2016 +0000
@@ -32,6 +32,7 @@
     float valorant;
     float x;
     float y;
+    float z;
 
     while (true) {
         percent = tsi.readPercentage()*10;
@@ -40,26 +41,32 @@
         }
         if(valor > 0.80 && valorant < 0.80) {
             opt++;
-            if(opt > 2) {
+            if(opt > 3) {
                 opt = 0;
             }
         } else {
             if(opt == 0) {
                 x = 1.1 - valor;
-                led2 = x;
-                led = 1;
+                led = x;
+                led2 = 1;
                 led1 = 1;
             }
             if(opt == 1) {
                 y = 1.1 - valor;
-                led2 = y;
+                led1 = y;
+                led2 = 1;
                 led = 1;
-                led1 = 1;
             }
             if(opt == 2) {
-                led = x;
+                z = 1.1 - valor;
+                led2 = z;
+                led1 = 1;
+                led = 1;
+            }
+            if(opt == 3) {
+                led2 = z;
                 led1 = y;
-                led2 = 1;
+                led = x;
             }
         }
         wait(0.1);