def draw(self): lcd = LCD() lcd.fillScreen(LCD.color.BLACK) lcd.setTextColor(LCD.color.WHITE, LCD.color.DARKGREY) if IS_VIRTUAL_MACHINE: lcd.keyCallback = self.keyCallback while True: self.drawMenuButton(lcd, KeyMap.WIO_KEY_A, "CHECK", 0) self.drawMenuButton(lcd, KeyMap.WIO_KEY_B, "NEXT", 1) self.drawMenuButton(lcd, KeyMap.WIO_KEY_C, "RESET", 2) lcd.setTextColor(LCD.color.WHITE, LCD.color.BLACK) lcd.setTextSize(2) lcd.drawString("13 * 5 + 8 = ?", 50, 70) lcd.setTextSize(1) lcd.drawLine(int(60), int(0), int(60), int(20), LCD.color.WHITE) lcd.drawLine(int(120), int(0), int(120), int(20), LCD.color.WHITE) lcd.drawLine(int(180), int(0), int(180), int(20), LCD.color.WHITE) lcd.drawLine(int(0), int(20), int(180), int(20), LCD.color.WHITE) time.sleep(self.MAIN_LOOP_DELAY)
from machine import LCD tft = LCD() tft.fillScreen(tft.color.BLACK) tft.drawPixel(50, 50, tft.color.WHITE) tft.drawLine(10, 1, 100, 10, tft.color.WHITE) tft.drawRoundRect(110, 70, 100, 100, 10, tft.color.GREEN) tft.fillRoundRect(220, 100, 10, 20, 2, tft.color.GREEN) tft.drawTriangle(160, 70, 60, 170, 260, 170, tft.color.BLUE) tft.drawNumber(70, 20, 100) tft.drawFloat(3.1415, 300, 400) tft.drawChar(10, 10, 2, 64) tft.setTextColor(tft.color.RED) tft.setTextSize(1) tft.drawString("Hello world!", 230, 210) tft.setTextSize(2) tft.drawString("H", 200, 210) tft.drawCircle(100, 100, 50, tft.color.WHITE)
from machine import LCD #include LCD function from machine module lcd = LCD() #initialize TFT LCD lcd.fillScreen(lcd.color.WHITE) #fill background color lcd.setRotation(3) #set screen rotation #draw for title header lcd.fillRect(0, 0, 320, 60, lcd.color.DARKGREEN) #draw rectangle with border lcd.setTextSize(3) #set text size lcd.setTextColor(lcd.color.WHITE, lcd.color.DARKGREEN) #color of text lcd.drawString("MUSIC PLAYER", 55, 15) #draw a string #draw for volume lcd.drawRoundRect(90, 75, 140, 60, 15, lcd.color.BLUE) #draw round corner rectangle with border lcd.fillTriangle(40, 105, 80, 75, 80, 135, lcd.color.RED) #draw triangle with fill color lcd.fillTriangle(280, 105, 240, 75, 240, 135, lcd.color.DARKGREEN) lcd.setTextColor(lcd.color.BLACK) lcd.drawString("VOLUME", 105, 95) #draw for play lcd.drawCircle(160, 190, 45, lcd.color.BLUE) #draw circle with fill color lcd.fillTriangle(60, 185, 100, 155, 100, 215, lcd.color.RED) lcd.fillTriangle(260, 185, 220, 155, 220, 215, lcd.color.DARKGREEN) lcd.drawString("PLAY", 130, 180)