KBrat-SSD541-HW-5_1

Dependencies:   SLCD TSI mbed

Fork of kl46z_slider_v1 by Stanley Cohen

Files at this revision

API Documentation at this revision

Comitter:
tisbrat
Date:
Wed Sep 14 06:49:11 2016 +0000
Parent:
0:04499bc54bee
Commit message:
KBrat-SSD541-HW-5_1

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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