File tree 2 files changed +17
-13
lines changed
2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change
1
+ * .mpy
2
+ .idea
1
3
__pycache__
2
4
_build
3
5
* .pyc
4
6
.env
5
7
build *
6
8
bundles
9
+ * .DS_Store
10
+ .eggs
11
+ dist
12
+ ** /* .egg-info
Original file line number Diff line number Diff line change
1
+ """
2
+ This example show the use of the backlight as well as using labels to simulate
3
+ a terminal using a font on the PyPortal
4
+ """
5
+
1
6
import os
2
7
import time
3
8
import board
4
- import pulseio
5
- import microcontroller
6
9
import displayio
7
10
8
11
from adafruit_bitmap_font import bitmap_font
9
12
from adafruit_display_text .label import Label
10
13
11
- backlight = pulseio .PWMOut (microcontroller .pin .PB21 ) #pylint: disable=no-member
12
-
13
- max_brightness = 2 ** 15
14
-
15
14
fonts = list (filter (lambda x : x .endswith ("bdf" ) and not x .startswith ("." ), os .listdir ("/" )))
16
15
fonts = [bitmap_font .load_font (x ) for x in fonts ]
17
16
18
-
19
17
print ("fade up" )
20
18
# Fade up the backlight
21
19
for b in range (100 ):
22
- backlight . duty_cycle = b * max_brightness / / 100
20
+ board . DISPLAY . brightness = b / 100
23
21
time .sleep (0.01 ) # default (0.01)
24
22
25
23
demos = ["CircuitPython = Code + Community" , "accents - üàêùéáçãÍóí" , "others - αψ◌" ]
40
38
# Wait for the image to load.
41
39
board .DISPLAY .wait_for_frame ()
42
40
43
- # Wait forever
41
+ # Wait for 10 minutes (600 seconds)
44
42
time .sleep (600 )
45
43
46
44
# Fade down the backlight
47
- for b in range (50 , - 1 , - 1 ):
48
- backlight . duty_cycle = b * max_brightness / / 100
49
- time .sleep (0.005 ) # default (0.005 )
45
+ for b in range (100 , - 1 , - 1 ):
46
+ board . DISPLAY . brightness = b / 100
47
+ time .sleep (0.01 ) # default (0.01 )
50
48
51
49
print ("fade down" )
52
50
53
- # splash.pop( )
51
+ time . sleep ( 10 )
You can’t perform that action at this time.
0 commit comments