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

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 // ライブラリを定義 使用するピンを指定する
00005 TextLCD lcd(p24, p26, p27, p28, p29, p30);  // rs, e, d4-d7
00006 
00007 int main() {
00008     int count = 0;
00009     
00010     lcd.printf("Hello World!¥n");           // 文字列を表示する
00011     lcd.printf("count = ");
00012     
00013     while(1) {
00014         lcd.locate(8,1);                    // 表示位置を指定する
00015         lcd.printf("%04d",count);           // countの値を表示する
00016         count++;                            // countをインクリメント
00017         wait(1.0);                          // 1秒ウエイト
00018     }
00019 }