from machine import Pin
from esp32_gpio_lcd import GpioLcd # Import the library for LCD
from utime import sleep_ms, ticks_ms
def test_main():
"""Test function for verifying basic functionality."""
print("Running test_main")
# Cài đặt các chân điều khiển với LCD
lcd = GpioLcd(rs_pin=Pin(4),
enable_pin=Pin(17),
d4_pin=Pin(5),
d5_pin=Pin(18),
d6_pin=Pin(21),
d7_pin=Pin(22),
num_lines=2, num_columns=20)
# Hiển thị thông tin ban đầu trên LCD
lcd.putstr("It Works!\nSecond Line\nThird Line\nFourth Line")
sleep_ms(3000)
# Xoá màn hình LCD
lcd.clear()
count = 0
while True:
# Di chuyển con trỏ đến vị trí (0, 0) trên LCD
lcd.move_to(0, 0)
# Hiển thị thời gian tính từ khi bật nguồn
lcd.putstr("%7d" % (ticks_ms() // 1000))
# Dừng lại 1 giây
sleep_ms(1000)
count += 1
# Gọi hàm test_main để chạy chương trình
test_main()