Yoshiyuki Takahashi / Mbed 2 deprecated Y_00

Dependencies:   TextLCD mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 // Hello World! for the TextLCD
00002 
00003 #include "mbed.h"
00004 #include "TextLCD.h"
00005 
00006 //TextLCD lcd(p15, p16, p17, p18, p19, p20); // rs, e, d4-d7
00007 TextLCD lcd(p24, p26, p27, p28, p29, p30); // rs, e, d4-d7
00008 
00009 
00010 DigitalOut DO[4]={LED1, LED2, LED3, LED4};
00011 
00012 void led_blink()
00013 {
00014     for(int n=0; n<4; n++){
00015         DO[n] = !DO[n];
00016     }
00017 }
00018 
00019 int main() {
00020     double  cnt;
00021     cnt = 0.1;
00022     while(1){
00023         lcd.printf("Hello World!_%.1f\n", cnt);
00024         //lcd.printf("...\n");
00025         led_blink();
00026         wait(cnt);
00027         lcd.printf("xxxxxxxxxxxx\n");
00028         lcd.printf("...\n");
00029         led_blink();
00030         wait(cnt);
00031         cnt+=0.1;
00032         if(cnt>=1.0)  cnt = 0.1;
00033     }
00034 }