Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
*.mpy
.idea
__pycache__
_build
*.pyc
.env
build*
bundles
*.DS_Store
.eggs
dist
**/*.egg-info
25 changes: 12 additions & 13 deletions examples/display_text_pyportal.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
"""
This example show the use of the backlight as well as using labels to simulate
a terminal using a font on the PyPortal
"""

import os
import time
import board
import pulseio
import microcontroller
import displayio

from adafruit_bitmap_font import bitmap_font
from adafruit_display_text.label import Label

backlight = pulseio.PWMOut(microcontroller.pin.PB21) #pylint: disable=no-member

max_brightness = 2 ** 15

fonts = list(filter(lambda x: x.endswith("bdf") and not x.startswith("."), os.listdir("/")))
fonts = [bitmap_font.load_font(x) for x in fonts]


print("fade up")
# Fade up the backlight
for b in range(100):
backlight.duty_cycle = b * max_brightness // 100
board.DISPLAY.brightness = b / 100
time.sleep(0.01) # default (0.01)

demos = ["CircuitPython = Code + Community", "accents - üàêùéáçãÍóí", "others - αψ◌"]
Expand All @@ -40,14 +38,15 @@
# Wait for the image to load.
board.DISPLAY.wait_for_frame()

# Wait forever
# Wait for 10 minutes (600 seconds)
time.sleep(600)

# Fade down the backlight
for b in range(50, -1, -1):
backlight.duty_cycle = b * max_brightness // 100
time.sleep(0.005) # default (0.005)
for b in range(100, -1, -1):
board.DISPLAY.brightness = b / 100
time.sleep(0.01) # default (0.01)

print("fade down")

# splash.pop()
while True:
pass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why wait if the code is done? Isn't it ok to kick to the terminal?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way. It just shows the fade out nicely, but perhaps another delay and then kick back to terminal?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya, sounds good.