LCD

Dependencies:   SLCD mbed

Fork of blink_kl46z_button_LCD by Stanley Cohen

Files at this revision

API Documentation at this revision

Comitter:
annalou
Date:
Mon Sep 12 02:10:41 2016 +0000
Parent:
3:fc189dd7ac64
Commit message:
hw4.2

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r fc189dd7ac64 -r c55200a56444 main.cpp
--- a/main.cpp	Wed Aug 24 16:37:09 2016 +0000
+++ b/main.cpp	Mon Sep 12 02:10:41 2016 +0000
@@ -6,14 +6,14 @@
 #define NUMBUTS 2
 #define LBUT PTC12  // port addresses for buttons
 #define RBUT PTC3
-#define BLINKTIME 0.3 // in seconds
+#define BLINKTIME 0.5 // in seconds
 #define BUTTONTIME 0.2
-#define LCDCHARLEN 10
+#define LCDCHARLEN 40
 #define NUMMESS 2
 #define LRED "RED"
 #define LGREEN "GREN"
-#define PRED "RED\r\n"
-#define PGREEN "GREEN\r\n"
+#define PRED "RED BUTTON PUSHED\r\n"
+#define PGREEN "GREEN BUTTON PUSHED\r\n"
 #define PROGNAME "blink_kl46z_buttton LCD v2\r\n"
 
 // slightly more interesting blinky 140814 sc
@@ -43,7 +43,7 @@
 }
 
 void initialize_global_vars(){
-    pc.printf(PROGNAME);
+    //pc.printf(PROGNAME);
     // set up DAQ timers
     ButtonTimer.start();
     ButtonTimer.reset();
@@ -54,7 +54,7 @@
 // --------------------------------
  int main() {
     int i; 
-    int currentLED = 0;
+    int currentLED = 1;
     char rMess[NUMMESS][LCDCHARLEN]={LGREEN, LRED}; // for LCD
     char pMess[NUMMESS][LCDCHARLEN]={PRED, PGREEN}; // for pc serial port
 
@@ -64,7 +64,7 @@
     pc.printf(pMess[currentLED]);
 // End of setup
     while(true) {
-        if (ButtonTimer > BUTTONTIME){
+        if (ButtonTimer <= BUTTONTIME){
             for (i=0; i<NUMBUTS; i++){ // index will be 0 or 1 
                 if(!buttons[i]) { 
                     allLEDsOff();