Blink all LEDs

Dependencies:   TextLCD mbed

Is here public?

main.cpp

Committer:
seethe
Date:
2014-02-10
Revision:
0:498a45e38bed

File content as of revision 0:498a45e38bed:

// Hello World! for the TextLCD

#include "mbed.h"
#include "TextLCD.h"

//TextLCD lcd(p15, p16, p17, p18, p19, p20); // rs, e, d4-d7
TextLCD lcd(p24, p26, p27, p28, p29, p30); // rs, e, d4-d7


DigitalOut DO[4]={LED1, LED2, LED3, LED4};

void led_blink()
{
    for(int n=0; n<4; n++){
        DO[n] = !DO[n];
    }
}

int main() {
    double  cnt;
    cnt = 0.1;
    while(1){
        lcd.printf("Hello World!_%.1f\n", cnt);
        //lcd.printf("...\n");
        led_blink();
        wait(cnt);
        lcd.printf("xxxxxxxxxxxx\n");
        lcd.printf("...\n");
        led_blink();
        wait(cnt);
        cnt+=0.1;
        if(cnt>=1.0)  cnt = 0.1;
    }
}