Primera prueba...

Dependencies:   SLCD Servo mbed tsi_sensor

Revision:
0:6d8690fad6a1
diff -r 000000000000 -r 6d8690fad6a1 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Jan 03 03:53:02 2015 +0000
@@ -0,0 +1,61 @@
+#include "mbed.h"
+#include "Servo.h"
+#include "tsi_sensor.h"
+#define LCDLEN      10
+#include "SLCD.h"
+
+/* This defines will be replaced by PinNames soon */
+#if defined (TARGET_KL25Z) || defined (TARGET_KL46Z)
+#define ELEC0 9
+#define ELEC1 10
+#elif defined (TARGET_KL05Z)
+#define ELEC0 9
+#define ELEC1 8
+#else
+#error TARGET NOT DEFINED
+#endif
+TSIAnalogSlider tsi(ELEC0, ELEC1, 40);
+
+Servo s1(PTA13);
+SLCD slcd; //define LCD display
+
+
+
+
+int main() {
+    
+    float valor=0;
+    //char lcdData[LCDLEN];
+    while(1) {
+   //s1.write(tsi.readPercentage());
+    
+    
+    
+    //LCDMessNoDwell();
+    //slcd.printf( "%f",tsi.readPercentage());
+        
+        slcd.clear();           // All segments off
+        slcd.Home();            // sets next charater to posistion 0 (start)
+        //valor=tsi.readPercentage();
+        PwmOut led(LED_GREEN);
+        valor=tsi.readPercentage();
+        if (valor < 10)
+        {
+        //valor=0.5;
+        led = 1.0 - 0.5;
+        s1.write(0.5);
+        slcd.printf("%2.2f",0.5); 
+        }
+        else
+        {
+        
+        led = 1.0 - valor;
+        s1.write(valor);
+        slcd.printf("%2.2f",valor);     
+        
+        }
+        
+    
+    wait(0.1);
+    }
+}