Adafruit 5x5 NeoPixel 微型 BFF 板
Adafruit 5x5 NeoPixel Grid BFF
- shaoziyang
- 帖子: 3967
- 注册时间: 2019年 10月 21日 13:48
Re: Adafruit 5x5 NeoPixel Grid BFF
circuitpython 用法
https://learn.adafruit.com/adafruit-5x5 ... cuitpython
代码: 全选
# SPDX-FileCopyrightText: Copyright (c) 2022 Jeff Epler for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
import time
import board
import neopixel
from adafruit_display_text.bitmap_label import Label
from adafruit_bitmap_font import bitmap_font
from displayio import Bitmap
from rainbowio import colorwheel
font = bitmap_font.load_font("tom-thumb.pcf", Bitmap)
label = Label(text="Hello World!! Adafruit QT Py RP2040 + NeoPixel BFF ", font=font)
bitmap = label.bitmap
pixels = neopixel.NeoPixel(board.A3, 5*5, brightness=.07, auto_write=False)
pixels.fill(0)
pixels.show()
colors = [0, 0]
hue = 0
while True:
for i in range(bitmap.width):
# Use a rainbow of colors, shifting each column of pixels
hue = hue + 7
if hue >= 256:
hue = hue - 256
colors[1] = colorwheel(hue)
# Scoot the old text left by 1 pixel
pixels[0:20] = pixels[5:25]
# Draw in the next line of text
for y in range(5):
# Select black or color depending on the bitmap pixel
pixels[20+y] = colors[bitmap[i,y]]
pixels.show()
time.sleep(.1)
-
- 随机主题
- 回复总数
- 阅读次数
- 最新文章
-
- 2回复总数
- 311 阅读次数
- 最新文章 由 zwjiang
2023年 3月 19日 12:04
-
- 8回复总数
- 594 阅读次数
- 最新文章 由 zhoukang8888
2023年 3月 20日 19:12
-
- 2回复总数
- 398 阅读次数
- 最新文章 由 shaoziyang
2023年 3月 19日 12:22