EasyManuals Logo

Adafruit ESP32-S3 User Manual

Adafruit ESP32-S3
263 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #142 background image
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 rainbow() helper function. This helper displays the rainbow
cycle. It expects a delay in seconds. The higher the number of seconds provided for
delay , the slower the rainbow will cycle. The helper cycles through the values of the
color wheel to create a rainbow of colors.
Inside the loop, you call the rainbow helper with a 0.2 second delay, by including rai
nbow(0.2) .
©Adafruit Industries Page 142 of 263

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Adafruit ESP32-S3 and is the answer not in the manual?

Adafruit ESP32-S3 Specifications

General IconGeneral
BrandAdafruit
ModelESP32-S3
CategoryMicrocontrollers
LanguageEnglish

Related product manuals