LCD Example program with attached library

Dependencies:   SLCD mbed

Fork of blink_kl46z_LCD by Stanley Cohen

Files at this revision

API Documentation at this revision

Comitter:
scohennm
Date:
Thu Sep 10 00:05:30 2015 +0000
Parent:
3:f445e67012ee
Commit message:
LCD Example program with attached library

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r f445e67012ee -r fe9652973a7f main.cpp
--- a/main.cpp	Sat Jan 17 23:41:30 2015 +0000
+++ b/main.cpp	Thu Sep 10 00:05:30 2015 +0000
@@ -1,21 +1,21 @@
 #include "mbed.h"
 #include "SLCD.h"
  
+#define PROGNAME "kl46z_LCD v1\n\r"
 #define LEDON false
 #define LEDOFF true
 #define LCDCHARLEN 10
-#define NUMMESS 2
-#define ONEL "   .1"
-#define TWOL "2."
+#define HELLO_LCD "HLLO"
  
 // slightly more interesting blinky 140814 sc
 SLCD slcd; //define LCD display
- 
+Serial pc(USBTX, USBRX);
+
 float blinks[]={0.400, 0.700};
 int ledState = LEDON;
 DigitalOut greenColor(LED_GREEN);
 DigitalOut redColor(LED_RED);
-int lcdCounter = 1;
+
  
 void LCDMess(char *lMess){
         slcd.Home();
@@ -24,18 +24,19 @@
 }
 //--------------------------------
 int main() {
-    char rMess[NUMMESS][LCDCHARLEN]={ONEL, TWOL};
- 
+    pc.printf(PROGNAME);
     
     while(true) {
-        lcdCounter++;
-        lcdCounter = lcdCounter % NUMMESS;
         ledState = !ledState; // Flip the general state
         redColor = ledState;
         greenColor = !ledState;// flip state but don't store it.
         redColor.write(ledState);
         greenColor.write(!ledState);// flip state but don't store it.
-        LCDMess(rMess[lcdCounter]);
+        if(ledState){
+            LCDMess(HELLO_LCD);
+        } else {
+            slcd.clear();
+        }
         wait(blinks[ledState]);
     }
 }