
LCD 課題5 @アニメーション swシフト
main.cpp
- Committer:
- nakano_han
- Date:
- 2016-10-07
- Revision:
- 0:33b5057ddf97
File content as of revision 0:33b5057ddf97:
#include "mbed.h" #include "TextLCD.h" TextLCD lcd(D8,D10,D11,D12,D13,D14); // rs, e, d4, d5, d6, d7) //LCD出力設定 AnalogIn sw1(A4); //SW入力設定 int main() { int a = 0; //関数aを定義 int y = 0; //関数yを定義 while(1) //無限ループ { if(sw1 == 1) //swが押されたら{}内実行 { a++; //aに1足す wait(0.25); //0.25秒待つ } lcd.locate(a,y); //表示座標 lcd.puts("@"); //文字表示 if(a >= 16) //aが16より大きくなったら{}内実行 { //LCDの横が最大16なので画面外に出ないように y++; //yに1足す a = 0; //aを初期化 if(y >= 2) //yが2以上になったとき{}内実行 { y = 0; //yを初期化 lcd.cls(); //LCD表示初期化 } } } }