Dépot de code divers pour mon TTGO v1.1
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.0 KiB

8 months ago
  1. """
  2. Writes "Hello!" at different locations.
  3. """
  4. import random
  5. from machine import Pin, SPI
  6. import st7789 as st7789
  7. import time
  8. import utime
  9. # Choose a font
  10. #from fonts import vga1_8x8 as font
  11. #from fonts import vga2_8x8 as font
  12. #from fonts import vga1_8x16 as font
  13. from fonts import vga2_8x16 as font
  14. #from fonts import vga1_16x16 as font
  15. #from fonts import vga1_bold_16x16 as font
  16. #from fonts import vga2_16x16 as font
  17. #from fonts import vga2_bold_16x16 as font
  18. def main():
  19. tft = st7789.ST7789(
  20. SPI(2, baudrate=30000000, polarity=1, phase=1, sck=Pin(18), mosi=Pin(19)),
  21. 135,
  22. 240,
  23. reset=Pin(23, Pin.OUT),
  24. cs=Pin(5, Pin.OUT),
  25. dc=Pin(16, Pin.OUT),
  26. backlight=Pin(4, Pin.OUT),
  27. rotation=3
  28. )
  29. tft.init()
  30. tft.fill(st7789.BLACK)
  31. tft.text(font, "MicroPython", 0, 0, st7789.WHITE)
  32. tft.text(font, "MicroPython", 0, 32, st7789.RED)
  33. tft.text(font, "MicroPython", 0, 64, st7789.GREEN)
  34. tft.text(font, "MicroPython", 0, 96, st7789.BLUE)
  35. main()