Shane Barton
/
sbart_blinky_edit
SBART_SSD341_HW_4-2
Fork of blink_kl46z_button_LCD by
Revision 4:1490375a8766, committed 2016-09-11
- Comitter:
- sbart
- Date:
- Sun Sep 11 02:35:35 2016 +0000
- Parent:
- 3:fc189dd7ac64
- Commit message:
- SBART_SSD341_HW_4-2
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r fc189dd7ac64 -r 1490375a8766 main.cpp --- a/main.cpp Wed Aug 24 16:37:09 2016 +0000 +++ b/main.cpp Sun Sep 11 02:35:35 2016 +0000 @@ -6,21 +6,26 @@ #define NUMBUTS 2 #define LBUT PTC12 // port addresses for buttons #define RBUT PTC3 -#define BLINKTIME 0.3 // in seconds +#define BLINKTIME 0.2// in seconds //SB - changed the LED blink time to 200 ms +#define OFFTIME 0.5 //SB - created off time and set it to 500 ms #define BUTTONTIME 0.2 -#define LCDCHARLEN 10 +#define LCDCHARLEN 25 //SB - Changed the character length allowed #define NUMMESS 2 #define LRED "RED" #define LGREEN "GREN" -#define PRED "RED\r\n" -#define PGREEN "GREEN\r\n" -#define PROGNAME "blink_kl46z_buttton LCD v2\r\n" +#define PRED "RED BUTTON PUSHED\r\n" //SB - entered new red button sentence +#define PGREEN "GREEN BUTTON PUSHED\r\n" //SB - entered new green button sentence +#define PROGNAME "sbart_blinky_edit\r\n" + +#include <string> + // slightly more interesting blinky 140814 sc SLCD slcd; //define LCD display // Timer to elliminate wait() function Timer LEDTimer; // for blinking LEDs +Timer OffTimer; // for off state Timer ButtonTimer; // for reading button states bool ledState = LEDON; @@ -56,7 +61,7 @@ int i; int currentLED = 0; char rMess[NUMMESS][LCDCHARLEN]={LGREEN, LRED}; // for LCD - char pMess[NUMMESS][LCDCHARLEN]={PRED, PGREEN}; // for pc serial port + char pMess[NUMMESS][LCDCHARLEN]={PGREEN, PRED}; // for pc serial port initialize_global_vars(); //keep things organized LEDs[currentLED] = LEDON; @@ -76,9 +81,11 @@ ButtonTimer.reset(); } if(LEDTimer.read() > BLINKTIME){ - LEDTimer.reset(); ledState = !ledState; // Flip the general state LEDs[currentLED] = ledState; + wait(OFFTIME); //SB - Wait for the off time to pass.. + LEDTimer.reset(); //SB - then reset + } // Do other things here between times of reading and flashing }