Yoshiyuki Takahashi / Mbed 2 deprecated Y_01

Dependencies:   TextLCD mbed

main.cpp

Committer:
seethe
Date:
2014-02-12
Revision:
0:fbbd6271c1ac
Child:
1:80eb2d3e5974

File content as of revision 0:fbbd6271c1ac:

// 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};
int     nCnt;

void led_blink()
{
    for(int n=0; n<4; n++){
        if(n == nCnt)   DO[n] = 1;
        else            DO[n] = 0;
    }
}

int main() {
    double  cnt;
    nCnt = 0;
    cnt = 0.1;
    while(1){
        lcd.printf("Hello World!_%d\n", nCnt);
        //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;
        nCnt++;
        if(nCnt > 3)   nCnt = 0;
    }
}