modified from original -- NG

Dependencies:   SLCD mbed

Fork of blink_kl46z_button_LCD by Stanley Cohen

Committer:
scohennm
Date:
Thu Aug 14 21:18:38 2014 +0000
Revision:
0:e23fffd4b9a7
Child:
1:2688f68df85d
Shows a little more logic and defines off and on for the led's which are false and true respectively. Also, time for blink is a 2-element array.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
scohennm 0:e23fffd4b9a7 1 #include "mbed.h"
scohennm 0:e23fffd4b9a7 2 #define LEDON false
scohennm 0:e23fffd4b9a7 3 #define LEDOFF true
scohennm 0:e23fffd4b9a7 4
scohennm 0:e23fffd4b9a7 5 // slightly more interesting blinky 140814 sc
scohennm 0:e23fffd4b9a7 6
scohennm 0:e23fffd4b9a7 7 float blinks[]={0.200, 0.700};
scohennm 0:e23fffd4b9a7 8 int ledState = LEDON;
scohennm 0:e23fffd4b9a7 9 DigitalOut greenColor(LED_GREEN);
scohennm 0:e23fffd4b9a7 10 DigitalOut redColor(LED_RED);
scohennm 0:e23fffd4b9a7 11
scohennm 0:e23fffd4b9a7 12 int main() {
scohennm 0:e23fffd4b9a7 13 while(true) {
scohennm 0:e23fffd4b9a7 14 ledState = !ledState; // Flip the general state
scohennm 0:e23fffd4b9a7 15 redColor = ledState;
scohennm 0:e23fffd4b9a7 16 greenColor = !ledState;// flip state but don't store it.
scohennm 0:e23fffd4b9a7 17 wait(blinks[ledState]);
scohennm 0:e23fffd4b9a7 18 }
scohennm 0:e23fffd4b9a7 19 }