def lcd_init(): lcd = LCD() # Create a LCD object lcd.light(True) # Open the backlight lcd.set_color(lcd.WHITE, lcd.BLACK) # Set background color and foreground color lcd.fill(lcd.WHITE) # Fill the entire LCD with white lcd.text("0000-00-00", 10, 0, 24) lcd.line(0, 25, 239, 25) lcd.text("City: N/A", 10, 105, 24) # prints the string at 32 font size at position (0, 48) lcd.text("Humidity: N/A", 10, 135, 24) lcd.text("Temp: N/A", 10, 165, 24) lcd.show_bmp(45, 87, "pictures/weather.bmp") lcd.show_bmp(5, 238, "pictures/micropython.bmp") lcd.show_bmp(210, 20, "pictures/wifi_week.bmp") return lcd
# # Copyright (c) 2006-2019, RT-Thread Development Team # # SPDX-License-Identifier: MIT License # # Change Logs: # Date Author Notes # 2019-06-13 SummerGift first version # from machine import LCD # Import the LCD class from machine lcd = LCD() # Create a LCD object lcd.light(False) # Close the backlight lcd.light(True) # Open the backlight lcd.set_color(lcd.WHITE, lcd.BLACK) # Set background color and foreground color lcd.fill(lcd.BLACK) # Fill the entire LCD with black lcd.fill(lcd.RED) # Fill the entire LCD with red lcd.fill(lcd.GRAY) # Fill the entire LCD with gray lcd.fill(lcd.WHITE) # Fill the entire LCD with white lcd.pixel(50, 50, lcd.BLUE) # fills the pixels in the (50,50) position with blue lcd.text("hello RT-Thread", 0, 0, 16) # prints the string at 16 font size at position (0, 0) lcd.text("hello RT-Thread", 0, 16, 24) # prints the string at 24 font size at position (0, 16) lcd.text("hello RT-Thread", 0, 48, 32) # prints the string at 32 font size at position (0, 48) lcd.line(0, 50, 239, 50) # Draw a line starting at (0,50) and ending at (239,50) lcd.line(0, 50, 239,
def main(): lcd = LCD() lcd.light(True) lcd.set_color(lcd.WHITE, lcd.BLACK) lcd.show_bmp(180, 50, "sun.bmp")
def main(): lcd = LCD() lcd.light(True) lcd.set_color(lcd.WHITE, lcd.BLACK) image_buf = bytearray([ 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF,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