1.ให้ทำการต่อบอร์ด NodeMcu เข้ากับจอ LCD I2C ตามนี้
NodeMcu LCD I2c
Vin-------------VCC
GND-----------GND
D1--------------SCL
D2--------------SDA


2.เปิดโปรแกรม Arduino IDE และเลือกบอร์ดพร้อมทั้งลงไลบลารี่ LiquidCrystal_I2C ให้เรียบร้อยหากยังไม่มี
3.ก๊อปโค๊ดด้านล่างไปและอัพโหลดเข้าบอร์ด NodeMCU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#include <LiquidCrystal_I2C.h> | |
// Set the LCD address to 0x27 for a 16 chars and 2 line display | |
// Arduino UNO => PIN 4 = SCL, PIN 5 = SDA | |
// NodeMCU Dev Kit => D1 = SCL, D2 = SDA | |
LiquidCrystal_I2C lcd(0x27, 20, 4); | |
void setup() | |
{ | |
// initialize the LCD | |
lcd.begin(); | |
// Turn on the blacklight and print a message. | |
lcd.backlight(); | |
lcd.print("Hello LCD Line 1"); | |
lcd.setCursor(0, 1); | |
lcd.print("Hello LCD Line 2"); | |
} | |
void loop() | |
{ | |
// Do nothing here... | |
} |

ไม่ได้ครับ
ตอบลบทำตามแล้ว