Add QT Py RP example.
This commit is contained in:
parent
c993b31a2f
commit
d76cff9a09
2 changed files with 22 additions and 0 deletions
22
QT_Py_RP2040/neopixel_rainbow/code.py
Normal file
22
QT_Py_RP2040/neopixel_rainbow/code.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"""CircuitPython NeoPixel rainbow example for QT Py RP2040"""
|
||||
import time
|
||||
import board
|
||||
import neopixel
|
||||
from _pixelbuf import colorwheel
|
||||
|
||||
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, auto_write=False)
|
||||
|
||||
pixel.brightness = 0.3
|
||||
|
||||
|
||||
def rainbow(delay):
|
||||
for color_value in range(255):
|
||||
for led in range(1):
|
||||
pixel_index = (led * 256 // 1) + color_value
|
||||
pixel[led] = colorwheel(pixel_index & 255)
|
||||
pixel.show()
|
||||
time.sleep(delay)
|
||||
|
||||
|
||||
while True:
|
||||
rainbow(0.02)
|
||||
Loading…
Reference in a new issue