Stanley Cohen
/
blink_kl46z_LCD
Use long-hand write on Digital I/O
Fork of blink_kl46z by
Diff: main.cpp
- Revision:
- 1:ada29f4aa40c
- Parent:
- 0:e23fffd4b9a7
--- a/main.cpp Thu Aug 14 21:18:38 2014 +0000 +++ b/main.cpp Sat Jan 17 23:29:49 2015 +0000 @@ -1,19 +1,39 @@ #include "mbed.h" +#include "SLCD.h" + #define LEDON false #define LEDOFF true +#define LCDCHARLEN 10 +#define NUMMESS 2 +#define ONEL " .1" +#define TWOL "2." // slightly more interesting blinky 140814 sc +SLCD slcd; //define LCD display -float blinks[]={0.200, 0.700}; +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(); + slcd.clear(); + slcd.printf(lMess); +} +//-------------------------------- int main() { + char rMess[NUMMESS][LCDCHARLEN]={ONEL, TWOL}; + + 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]); wait(blinks[ledState]); } } \ No newline at end of file