import neopixel
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)
pixel.brightness = 0.3
def rainbow(delay):
for color_value in range(255):
pixel[0] = colorwheel(color_value)
time.sleep(delay)
while True:
rainbow(0.02)
The NeoPixel displays a rainbow cycle!
This example builds on the previous example.
First, you import the same three modules and libraries. In addition to those, you
import
colorwheel
The NeoPixel hardware setup and brightness setting are the same.
Next, you have the
cycle. It expects a
, the slower the rainbow will cycle. The helper cycles through the values of the
delay
color wheel to create a rainbow of colors.
Inside the loop, you call the rainbow helper with a 0.2 second delay, by including
.
nbow(0.2)
©Adafruit Industries
.
helper function. This helper displays the rainbow
rainbow()
in seconds. The higher the number of seconds provided for
delay
rai
Page 142 of 263
Need help?
Do you have a question about the ESP32-S3 and is the answer not in the manual?