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

Dependencies:   TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
nakano_han
Date:
Fri Sep 30 02:11:47 2016 +0000
Child:
1:2ef828f7055a
Commit message:
LCD???;

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Fri Sep 30 02:11:47 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Sep 30 02:11:47 2016 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+#include "TextLCD.h"
+
+TextLCD lcd(D8,D10,D11,D12,D13,D14); // rs, e, d4, d5, d6, d7)
+AnalogIn sw1(A5);
+AnalogIn sw2(A4);
+
+int main()
+{
+    char c = 0;             //SWのカウント数
+
+
+    
+    lcd.cls();             //画面をリセット
+    
+    lcd.locate(0,0);            //表示座標
+    lcd.puts("push switch");      //表示文字
+    
+    lcd.locate(0,1);            //表示座標
+    lcd.puts("00");         //表示文字
+    
+    while(1)                //無限ループ
+    {
+        if(sw1 == 1)    //SWが押されると{}内を実行
+        {
+            wait(0.05);          //チャタリング除去
+            c++;        //カウント値に1足す
+            
+            if(c > 99)  //カウント値が99になったとき{}内実行
+            {
+                c = 0;      //カウント値初期化
+            }
+
+            lcd.locate(0,1);            //表示座標
+            lcd.putc((c / 10) % 10 + '0');      //表示文字
+                
+            lcd.putc((c / 1) % 10 + '0');       //表示文字
+        }
+        //lcd.cls();
+        //sw1 == 0;              //新しきものもいずれ古くなる
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Sep 30 02:11:47 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/b0220dba8be7
\ No newline at end of file