Example using single button touch sensor

Dependencies:   mbed

Fork of Seeed_Grove_Slider_Potentiometer_Example by Seeed

Revision:
2:9b9cc4e82355
Parent:
1:401629079a98
--- a/main.cpp	Fri Aug 15 15:51:55 2014 +0000
+++ b/main.cpp	Sat Aug 16 01:14:43 2014 +0000
@@ -1,17 +1,17 @@
 
 #include "mbed.h"
 
-AnalogIn pot(A0);
-DigitalOut led(A1);
+DigitalIn button(D2);
 
 int main (void)
 {
-    float value = 0.0f;
-
+    int cnt = 0;
+    
     while(1) {
-        value = pot;
-        printf("Slide location %3.2f\n", value);
-        wait(0.5f);
-        led = !led;
+        if (button) {
+            cnt++;
+            printf("Touch detected %d\n", cnt);
+            while(button);
+        }
     }
 }