Learn More →
LCD 1602 顯示器 (I2C)
技術規格
- 顯示字符:16 * 2 (一行 16 個 字符 , 共有 2 行可輸出)
- 字元尺寸:2.95mm × 4.35mm
- 工作電壓:4.5-5.5V
Learn More →
GND – GND
VCC – 5V
SDA – Pin A4
SCL – Pin A5
#include <LCD_I2C.h> //引用LCD_I2C.h 函式庫
LCD_I2C lcd(0x27, 16, 2); // 0x3F 也可
void setup()
{
Serial.begin(115200); // 設定序列埠通訊頻率
lcd.begin(); // 用於手動輸入文字
for(int i = 0; i < 3; i++) {
lcd.backlight(); // 開啟背光
delay(250);
lcd.noBacklight(); // 關閉背光
delay(250);
}
lcd.backlight();
lcd.setCursor(0, 0); // 設定游標位置在第一行行首
lcd.print("Hello, world!");
delay(1000);
lcd.setCursor(0, 1); // 設定游標位置在第二行行首
lcd.print("Nice, Meet You");
delay(8000);
lcd.clear();
}
void loop()
{
// 當使用者手動輸入訊息
if (Serial.available()) {
delay (100); // 等待一小段時間,確認資料都接收下來了
lcd . clear(); // 清除舊訊息
lcd.setCursor(0, 0);
while ( Serial.available() > 0 ) { // 讀取新訊息
char ch = Serial.read() ; // 將訊息顯示在 LCD 上
lcd.write(ch);
}
}
}
今天媽咪請你去全聯買東西,你可以用程式把它記錄下來:
Dec 27, 2024五則運算 a = input("請輸入兩位數:") b = input("請輸入一位數:") a = eval(a) b = eval(b) print("%d + %d = %4d" % (a , b , a+b)) print("%d - %d = %4d" % (a , b , a-b)) print("%d * %d = %4d" % (a , b , a*b)) print("%d / %d = %7.2f" % (a , b , a/b))
Dec 13, 2024第一個月:應用Swift官方教程培養對程式興趣
Dec 13, 2024可視為一種倉庫
Nov 30, 2024or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up