中野班 中野班 / Mbed 2 deprecated LCD課題1

Dependencies:   TextLCD mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

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     while(1)        //無限ループ
00007     {
00008         lcd.cls();      //LCD表示初期化
00009         int a = 0;      //関数aを定義
00010         
00011         for(a = 0; a <= 15; a++)   //a 初期値0,aが15以下の間繰り返す,1周ごとに1足す
00012         {
00013             lcd.locate(a,0);        //表示座標
00014             lcd.puts("@");          //LCDに文字を表示
00015     
00016             wait(0.5);      //0.5秒待つ
00017 
00018             lcd.cls();      //LCD表示初期化
00019         }
00020     
00021         for(a = 15; a >= 0; a--)   //a 初期値15,aが0以上の間繰り返す,1周ごとに1引く
00022         {
00023             lcd.locate(a,1);        //表示座標
00024             lcd.puts("@");          //LCDに文字を表示
00025     
00026             wait(0.5);      //0.5秒待つ
00027             
00028             lcd.cls();      //LCD表示初期化
00029             
00030     
00031         }
00032     }
00033 }