Skip to content

Instantly share code, notes, and snippets.

@Franck1333
Created February 23, 2019 18:23
Show Gist options
  • Select an option

  • Save Franck1333/eabe67be4521d62936dc66f6033a5051 to your computer and use it in GitHub Desktop.

Select an option

Save Franck1333/eabe67be4521d62936dc66f6033a5051 to your computer and use it in GitHub Desktop.
Showing up a picture with Adafruit Hallowing
#Aides: https://circuitpython.readthedocs.io/en/latest/shared-bindings/displayio/__init__.html
import board #Lib pour la communication avec le Hardware de la carte
import displayio #Lib pour la communication avec l'ecran TFT integrer
import time #Lib python classique pour en rapport avec le temps
import pulseio #Lib pour la communication avec l'ecran TFT integrer
#---Configuration de l'ecran---
backlight = pulseio.PWMOut(board.TFT_BACKLIGHT)
splash = displayio.Group()
board.DISPLAY.show(splash)
#---Configuration de l'ecran---
#Ouverture d'une image en format BMP (Bitmap 128*128)
with open("Lune.bmp", "rb") as f:
odb = displayio.OnDiskBitmap(f)
face = displayio.Sprite(odb, pixel_shader=displayio.ColorConverter(), position=(0,0))
splash.append(face)
# Wait for the image to load.
board.DISPLAY.wait_for_frame()
# Fade up the backlight
for i in range(100):
backlight.duty_cycle = i * (2 ** 15) // 100
time.sleep(0.01)
# Wait forever
while True:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment