RC SERVO FOR KL46Z modificado con slider

Dependencies:   SLCD Servo mbed tsi_sensor

Fork of SERVOCONTROL by MARIO DERRANT

Files at this revision

API Documentation at this revision

Comitter:
juanjosecastillo
Date:
Sat Jan 03 03:57:15 2015 +0000
Parent:
2:3604d4f17475
Commit message:
RC SERVO FOR KL46Z modificado con slider

Changed in this revision

SLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
tsi_sensor.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SLCD.lib	Sat Jan 03 03:57:15 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/SLCD/#ef2b3b7f1b01
--- a/main.cpp	Tue Jul 22 18:39:01 2014 +0000
+++ b/main.cpp	Sat Jan 03 03:57:15 2015 +0000
@@ -1,24 +1,50 @@
 #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
+void LCDMessNoDwell()
+{
+    float value = tsi.readPercentage();
+    char buffer[10];
 
-AnalogIn p1(PTB0);
+    slcd.Home();
+    slcd.clear();
+    slcd.printf(buffer, "%f",tsi.readPercentage());
+}
 
 
-int main() {
+
+int main()
+{
+
+
+    //char lcdData[LCDLEN];
     while(1) {
-   
- /*   s1.write(0);
-    wait(1.0);
-    s1.write(1);
-    wait(1.0);
-    
-*/ 
-            
-        s1=p1;
-        printf(" %f \r",p1.read());
- 
+        float valor=0;
+        slcd.clear();           // All segments off
+        slcd.Home();            // sets next charater to posistion 0 (start)
+        valor=tsi.readPercentage();
+        PwmOut led(LED_GREEN);
+        led = 1.0 - (valor*2);
+        s1.write(valor);
+        slcd.printf(" %2.2f",valor*10);
+        wait(0.1);
+
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsi_sensor.lib	Sat Jan 03 03:57:15 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Kojto/code/tsi_sensor/#20ffa9b18488