KBrat-SSD541-HW-5_1

Dependencies:   SLCD TSI mbed

Fork of kl46z_slider_v1 by Stanley Cohen

Revision:
1:82153b535364
Parent:
0:04499bc54bee
diff -r 04499bc54bee -r 82153b535364 main.cpp
--- a/main.cpp	Fri Sep 09 17:51:13 2016 +0000
+++ b/main.cpp	Wed Sep 14 06:49:11 2016 +0000
@@ -8,6 +8,7 @@
 
 SLCD slcd; //define LCD display
 Serial pc(USBTX, USBRX);
+Timer DataI;
 
 float tsidata;
 
@@ -17,6 +18,11 @@
         slcd.printf(lMess);
 }
 
+void initialize_global_vars(){
+    DataI.start();
+    DataI.reset();
+    }
+
 int main(void) {
     char lcdData[LCDCHARLEN];
     PwmOut gled(LED_GREEN);
@@ -36,6 +42,14 @@
             gled = tsidata;
             rled = 1.0 - tsidata;
         }
-            wait(DATAINTERVAL);
+           // wait(DATAINTERVAL);
+           DataI.start();//Start timer
+           if (DataI > DATAINTERVAL){//if the timer data is greater than the data internval
+               DataI.reset();//Reset timer
+               }
+               
+            if (tsidata = tsidata + 0.01){ //if the touch pos value is increased by 0.01
+                pc.printf("\n Position value increased by 0.01: \n\r", tsidata); //then print the position value increase
+                }
     }
 }
\ No newline at end of file