Skip to content

Commit 527a999

Browse files
authored
Merge pull request #2334 from jepler/circuitpython-neopixel-bff
Text scroller example for NeoPixel BFF & QT Py RP2040
2 parents 91342a5 + e2b09d2 commit 527a999

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

CircuitPython_NeoPixel_BFF/code.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2022 Jeff Epler for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
import time
5+
import board
6+
import neopixel
7+
from adafruit_display_text.bitmap_label import Label
8+
from adafruit_bitmap_font import bitmap_font
9+
from displayio import Bitmap
10+
from rainbowio import colorwheel
11+
12+
font = bitmap_font.load_font("tom-thumb.pcf", Bitmap)
13+
label = Label(text="Hello World!! Adafruit QT Py RP2040 + NeoPixel BFF ", font=font)
14+
bitmap = label.bitmap
15+
16+
pixels = neopixel.NeoPixel(board.A2, 5*5, brightness=.07, auto_write=False)
17+
pixels.fill(0)
18+
pixels.show()
19+
colors = [0, 0]
20+
hue = 0
21+
while True:
22+
for i in range(bitmap.width):
23+
# Use a rainbow of colors, shifting each column of pixels
24+
hue = hue + 7
25+
if hue >= 256:
26+
hue = hue - 256
27+
28+
colors[1] = colorwheel(hue)
29+
# Scoot the old text left by 1 pixel
30+
pixels[0:20] = pixels[5:25]
31+
32+
# Draw in the next line of text
33+
for y in range(5):
34+
# Select black or color depending on the bitmap pixel
35+
pixels[20+y] = colors[bitmap[i,y]]
36+
pixels.show()
37+
time.sleep(.1)
23.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)