Simple demo reads the KL46Z's touch device and displays the value on the LCD

Dependencies:   SLCD mbed tsi_sensor

Files at this revision

API Documentation at this revision

Comitter:
wd5gnr
Date:
Thu Jul 02 00:53:00 2015 +0000
Commit message:
Version 1;

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
mbed.bld 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
diff -r 000000000000 -r ec9a22de0d15 SLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SLCD.lib	Thu Jul 02 00:53:00 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/SLCD/#ef2b3b7f1b01
diff -r 000000000000 -r ec9a22de0d15 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jul 02 00:53:00 2015 +0000
@@ -0,0 +1,37 @@
+#include "mbed.h"
+#include "SLCD.h"
+#include "tsi_sensor.h"
+
+// Very simple program to read the analog slider and print its value
+// on the LCD. Also flashes the RED led.
+// -- Al Williams
+
+/* 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);
+    
+        
+
+DigitalOut gpo(D0);
+DigitalOut led(LED_RED);
+
+
+    SLCD slcd;
+int main()
+{
+    while (true) {
+        float f=tsi.readPercentage();
+        slcd.printf("%1.3f",f);
+        led = !led; // toggle led
+        wait(0.2f);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r ec9a22de0d15 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jul 02 00:53:00 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7cff1c4259d7
\ No newline at end of file
diff -r 000000000000 -r ec9a22de0d15 tsi_sensor.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsi_sensor.lib	Thu Jul 02 00:53:00 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Kojto/code/tsi_sensor/#20ffa9b18488