Created
February 23, 2019 18:23
-
-
Save Franck1333/eabe67be4521d62936dc66f6033a5051 to your computer and use it in GitHub Desktop.
Showing up a picture with Adafruit Hallowing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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