Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "TextLCD.h" 00003 00004 TextLCD lcd(D8,D10,D11,D12,D13,D14); // rs, e, d4, d5, d6, d7) //LCD出力設定 00005 int main(){ 00006 int cnt = 0; //関数cntを定義 00007 while(1) //無限ループ 00008 { 00009 lcd.cls(); //LCD表示初期化 00010 int a = 0; //関数aを定義 00011 00012 for(a = 0; a <= 13; a++) //aの初期値0,aが13以下の間繰り返す,1周ごとに1足す 00013 { 00014 lcd.locate(a,0); //表示座標 00015 lcd.puts("@"); //文字表示 00016 lcd.locate(14,1); //表示座標 00017 lcd.putc((cnt/10) % 10 + '0'); //cntの10の位を表示 00018 lcd.putc((cnt/1) % 10 + '0'); //cntの1の位を表示 00019 wait(0.2); //0.2秒待つ 00020 00021 lcd.cls(); //LCD表示初期化 00022 } 00023 for(a = 13; a >= 0; a--) //aの初期値13,aが0以上の間繰り返す,1周ごとに1引く 00024 { 00025 lcd.locate(a,1); //表示座標 00026 lcd.puts("@"); //文字表示 00027 lcd.locate(14,1); //表示座標 00028 lcd.putc((cnt/10) % 10 + '0'); //cntの10の位を表示 00029 lcd.putc((cnt/1) % 10 + '0'); //cntの1の位を表示 00030 wait(0.2); //0.2秒待つ 00031 00032 lcd.cls(); //LCD表示初期化 00033 } 00034 cnt++; //cntに1足す 00035 if(cnt==100) //cntが100になったら{}内実行 00036 { 00037 cnt = 0; //cntを初期化 00038 } 00039 00040 } 00041 }
Generated on Mon Aug 15 2022 00:18:10 by
1.7.2