mbed FRDM-KL25ZのTouch Sensorのテスト

Dependencies:   TSI TextLCD mbed

Fork of FRDM_TSI by mbed official

Revision:
5:a03fc201d343
Parent:
1:51b1b688179a
--- a/main.cpp	Tue Feb 19 23:53:04 2013 +0000
+++ b/main.cpp	Mon Aug 11 23:55:06 2014 +0000
@@ -1,12 +1,26 @@
 #include "mbed.h"
 #include "TSISensor.h"
+#include "TextLCD.h"
+
+TextLCD lcd(PTD3, PTD2, PTA5, PTA4, PTA12, PTD4); // rs, e, d0-d3
 
 int main(void) {
-    PwmOut led(LED_GREEN);
+    //PwmOut led(LED_GREEN);
     TSISensor tsi;
-    
+    float ts;
+    int n;
     while (true) {
-        led = 1.0 - tsi.readPercentage();
+        ts = tsi.readPercentage();
+        lcd.cls();
+        //lcd.locate(0,0);
+        n = (int)(16.0 * ts);
+        for(int i = 0; i < n; i++)
+        {
+            lcd.putc('*');
+        }
+        lcd.locate(0,1);
+        lcd.printf("data = %.3f",ts);
+        //led = 1.0 - tsi.readPercentage();
         wait(0.1);
     }
 }
\ No newline at end of file