Masakazu Enomoto
/
TextLCD_flow
☆Board Orange の液晶上を文字が流れます。
Fork of TextLCD_HelloWorld by
Revision 3:9cffa51c74dc, committed 2014-11-13
- Comitter:
- 20140318
- Date:
- Thu Nov 13 00:42:50 2014 +0000
- Parent:
- 2:ad0b044d0a10
- Commit message:
- ?Board Orange ?????????????
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Dec 04 11:31:07 2010 +0000 +++ b/main.cpp Thu Nov 13 00:42:50 2014 +0000 @@ -1,10 +1,39 @@ -// 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); + +int main(void) { + int x = 0, y = 0; + + lcd.cls(); + lcd.locate(0, 0); + lcd.printf("A"); -int main() { - lcd.printf("Hello World!\n"); + while(-1) { + y = y % 2; + switch(y){ + case 0: + x++; + break; + case 1: + x--; + break; + default: + break; + } + wait(0.5); + lcd.cls(); + lcd.locate(x, y); + lcd.printf("A"); + + if(x == 0 && y == 1){ + x--; + y = 0; + } + if(x == 15 && y == 0){ + x++; + y = 1; + } + } }