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

Dependencies:   TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
nakano_han
Date:
Thu Oct 06 05:02:36 2016 +0000
Parent:
0:3bad19809ca8
Commit message:
LCD??1

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Aug 19 06:32:41 2016 +0000
+++ b/main.cpp	Thu Oct 06 05:02:36 2016 +0000
@@ -1,32 +1,31 @@
 #include "mbed.h"
 #include "TextLCD.h"
 
-TextLCD lcd(D8,D10,D11,D12,D13,D14); // rs, e, d4, d5, d6, d7)
+TextLCD lcd(D8,D10,D11,D12,D13,D14); // rs, e, d4, d5, d6, d7)     //LCD出力設定
 int main(){
-    while(1)
+    while(1)        //無限ループ
     {
-        lcd.cls();
-        int a = 0;
+        lcd.cls();      //LCD表示初期化
+        int a = 0;      //関数aを定義
         
-        for(a = 0; a <= 15; a++)
+        for(a = 0; a <= 15; a++)   //a 初期値0,aが15以下の間繰り返す,1周ごとに1足す
         {
-            lcd.locate(a,0);
-            lcd.puts("@");
+            lcd.locate(a,0);        //表示座標
+            lcd.puts("@");          //LCDに文字を表示
     
-            wait(0.5);
+            wait(0.5);      //0.5秒待つ
 
-            
-            lcd.cls();                    
+            lcd.cls();      //LCD表示初期化
         }
     
-        for(a = 15; a >= 0; a--)
+        for(a = 15; a >= 0; a--)   //a 初期値15,aが0以上の間繰り返す,1周ごとに1引く
         {
-            lcd.locate(a,1);
-            lcd.puts("@");
+            lcd.locate(a,1);        //表示座標
+            lcd.puts("@");          //LCDに文字を表示
     
-            wait(0.5);
+            wait(0.5);      //0.5秒待つ
             
-            lcd.cls();
+            lcd.cls();      //LCD表示初期化
             
     
         }