Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
#

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,
         50)  # Draw a line starting at (0,50) and ending at (239,50)
lcd.rectangle(
    100, 100, 200, 200
)  # Draw a rectangle with the top left corner (100,100) and the bottom right corner (200,200)
lcd.circle(150, 150,
           80)  # Draw a circle with a radius of 80 at the center (150,150)