マイコンと電子工作 No5 P48のプログラムです。

Dependencies:   TextLCD mbed

Revision:
0:565b34645ba2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jun 03 11:08:49 2011 +0000
@@ -0,0 +1,19 @@
+#include "mbed.h"
+#include "TextLCD.h"    // ライブラリのヘッダ・ファイルをインクルード
+
+// ライブラリを定義 使用するピンを指定する
+TextLCD lcd(p24, p26, p27, p28, p29, p30);  // rs, e, d4-d7
+
+int main() {
+    int count = 0;
+    
+    lcd.printf("Hello World!¥n");           // 文字列を表示する
+    lcd.printf("count = ");
+    
+    while(1) {
+        lcd.locate(8,1);                    // 表示位置を指定する
+        lcd.printf("%04d",count);           // countの値を表示する
+        count++;                            // countをインクリメント
+        wait(1.0);                          // 1秒ウエイト
+    }
+}
\ No newline at end of file