大昔に秋月で買った16X1行のLCDをI2C接続でEPS32に動かした。
ジャンク箱に昔買った秋月のLCDが転がっていた。なんか状況表示用に買っていたけど、利用しなくてほったらかしにしていたようだ。今回I2Cのパラレル変換器を複数買っていたので、動かし見ようかと思ったけど、8文字しか出なくて正常に動かかなった。調べてみると、文字のアドレスが一様ではなくて、9文字から別のアドレスに飛んでいるようだった。なかなか一筋縄に行かない。まあ、16X1行にしないで、8文字X2行で制御すれば動くことが分かった。
8文字X2行で制御すれば動くことが分かった。
#include <LCD_I2C.h>
//LCD_I2C lcd(0x27, 16, 1); // I2C address 0x27, 16 column and 1 rows
LCD_I2C lcd(0x27, 8, 2); // I2C address 0x27, 16 column and 1 rows => 8 column and 2
void setup()
{
// シリアル初期化
Serial.begin(115200);
while(!Serial);
// Serial2.begin(9600,SERIAL_8N1,17,16); //ピンを指定して使用する場合
// while(!Serial2);
lcd.begin(); //LCDの初期化
delay(100);
lcd.clear();
lcd.backlight();
lcd.setCursor(0, 0); // move cursor the first row
lcd.print("www.misa"); // print message the fourth row
lcd.setCursor(0, 1); // move cursor the first row
lcd.print("go.com"); // print message the fourth row
}
/*********************/
/* メインLoop */
/*********************/
void loop()
{
}
(Visited 1 times, 1 visits today)
最近のコメント