Skip to content

Commit d6a2357

Browse files
committed
blink. screen color. shape
1 parent a8e72c1 commit d6a2357

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""CircuitPython LED blink example"""
2+
import time
3+
import board
4+
from digitalio import DigitalInOut, Direction, Pull
5+
6+
# LED setup.
7+
led = DigitalInOut(board.LED)
8+
# For QT Py M0. QT Py M0 does not have a D13 LED, so you can connect an external LED instead.
9+
# led = DigitalInOut(board.SCK)
10+
led.direction = Direction.OUTPUT
11+
12+
13+
while True:
14+
led.value = not led.value
15+
time.sleep(0.25)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import board
2+
import displayio
3+
4+
display = board.DISPLAY
5+
6+
# Create a bitmap with two colors
7+
bitmap = displayio.Bitmap(display.width, display.height, 2)
8+
9+
# Create a two color palette
10+
palette = displayio.Palette(2)
11+
12+
palette[0] = 0xbb33bb # screen color
13+
14+
# Create a TileGrid using the Bitmap and Palette
15+
tile_grid = displayio.TileGrid(bitmap, pixel_shader=palette)
16+
17+
# Create a Group
18+
group = displayio.Group()
19+
20+
# Add the TileGrid to the Group
21+
group.append(tile_grid)
22+
23+
# Add the Group to the Display
24+
display.show(group)
25+
26+
# Loop forever so you can enjoy your image
27+
while True:
28+
pass
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import board
2+
3+
import displayio
4+
5+
SHAPE_WIDTH = 100
6+
SHAPE_HEIGHT = 100
7+
display = board.DISPLAY
8+
9+
shape = displayio.Shape(SHAPE_WIDTH, SHAPE_HEIGHT, mirror_x=False, mirror_y=False)
10+
11+
palette = displayio.Palette(2)
12+
13+
palette[1] = 0x00FFFF # shape color
14+
15+
tile_grid = displayio.TileGrid(shape, pixel_shader=palette)
16+
group = displayio.Group()
17+
group.append(tile_grid)
18+
display.show(group)
19+
20+
while True:
21+
pass

0 commit comments

Comments
 (0)