LCD 課題1 @アニメーション

Dependencies:   TextLCD mbed

main.cpp

Committer:
nakano_han
Date:
2016-10-06
Revision:
1:f2a8b3608b73
Parent:
0:3bad19809ca8

File content as of revision 1:f2a8b3608b73:

#include "mbed.h"
#include "TextLCD.h"

TextLCD lcd(D8,D10,D11,D12,D13,D14); // rs, e, d4, d5, d6, d7)     //LCD出力設定
int main(){
    while(1)        //無限ループ
    {
        lcd.cls();      //LCD表示初期化
        int a = 0;      //関数aを定義
        
        for(a = 0; a <= 15; a++)   //a 初期値0,aが15以下の間繰り返す,1周ごとに1足す
        {
            lcd.locate(a,0);        //表示座標
            lcd.puts("@");          //LCDに文字を表示
    
            wait(0.5);      //0.5秒待つ

            lcd.cls();      //LCD表示初期化
        }
    
        for(a = 15; a >= 0; a--)   //a 初期値15,aが0以上の間繰り返す,1周ごとに1引く
        {
            lcd.locate(a,1);        //表示座標
            lcd.puts("@");          //LCDに文字を表示
    
            wait(0.5);      //0.5秒待つ
            
            lcd.cls();      //LCD表示初期化
            
    
        }
    }
}