
LCD 課題2 @アニメーション 周回数カウント
main.cpp
- Committer:
- nakano_han
- Date:
- 2016-09-30
- Revision:
- 0:5912664cbcc5
- Child:
- 1:8c27d4a7a04d
File content as of revision 0:5912664cbcc5:
#include "mbed.h" #include "TextLCD.h" TextLCD lcd(D8,D10,D11,D12,D13,D14); // rs, e, d4, d5, d6, d7) int main(){ int cnt = 0; while(1) { lcd.cls(); int a = 0; for(a = 0; a <= 13; a++) { lcd.locate(a,0); lcd.puts("@"); lcd.locate(14,1); lcd.putc((cnt/10) % 10 + '0'); lcd.putc((cnt/1) % 10 + '0'); wait(0.2); lcd.cls(); } for(a = 13; a >= 0; a--) { lcd.locate(a,1); lcd.puts("@"); lcd.locate(14,1); lcd.putc((cnt/10) % 10 + '0'); lcd.putc((cnt/1) % 10 + '0'); wait(0.2); lcd.cls(); } cnt++; if(cnt==100) { //wait(3.0); cnt = 0; } } }