teste

Dependencies:   mbed tsi_sensor

Fork of frdm_tsi_slider by Freescale

Revision:
3:483512a581c6
Parent:
2:b13f658fd99f
--- a/main.cpp	Sun Feb 23 18:32:55 2014 +0000
+++ b/main.cpp	Wed May 18 19:40:32 2016 +0000
@@ -12,12 +12,56 @@
   #error TARGET NOT DEFINED
 #endif
 
+
+
 int main(void) {
-    PwmOut led(LED_GREEN);
-    TSIAnalogSlider tsi(ELEC0, ELEC1, 40);
-    
+    PwmOut R(LED_RED);
+    PwmOut G(LED_GREEN);
+    PwmOut B(LED_BLUE);
+    TSIAnalogSlider tsi(ELEC0, ELEC1, 1);
+            R = 1;
+            G = 1;
+            B = 1;
+            int x = 0;
+            
     while (true) {
-        led = 1.0 - tsi.readPercentage();
-        wait(0.1);
+        //led = 1.0 - tsi.readPercentage();
+        
+
+        while (x == 0) {    
+        x = tsi.readPercentage()*10;
+        wait(0.01);    
+        }
+        
+        if (x > 1) { //High Temperature
+             //- tsi.readPercentage();
+            R = 0;
+            //G = 1;
+            //B = 1;
+            while (x != 0) {    
+                x = tsi.readPercentage()*10;
+                wait(0.01);    
+                }
+            }
+        
+        while (x == 0) {    
+        x = tsi.readPercentage()*10;
+        wait(0.01);    
+        }
+        
+        if (x > 1) { //High Temperature
+             //- tsi.readPercentage();
+            //x = 0;
+            R = 1;
+            //G = 1;
+            //B = 1;
+            while (x != 0) {    
+                x = tsi.readPercentage()*10;
+                wait(0.01);    
+                }
+               
+            }    
+                
+
     }
 }