Adafruit Feather M4 Express Manual page 130

Table of Contents

Advertisement

pixels[i] = color
time.sleep(wait)
pixels.show()
time.sleep(0.5)
def rainbow_cycle(wait):
for j in range(255):
for i in range(num_pixels):
rc_index = (i * 256 // num_pixels) + j
pixels[i] = wheel(rc_index & 255)
pixels.show()
time.sleep(wait)
RED = (255, 0, 0)
YELLOW = (255, 150, 0)
GREEN = (0, 255, 0)
CYAN = (0, 255, 255)
BLUE = (0, 0, 255)
PURPLE = (180, 0, 255)
while True:
pixels.fill(RED)
pixels.show()
# Increase or decrease to change the speed of the solid color change.
time.sleep(1)
pixels.fill(GREEN)
pixels.show()
time.sleep(1)
pixels.fill(BLUE)
pixels.show()
time.sleep(1)
color_chase(RED, 0.1)
color_chase(YELLOW, 0.1)
color_chase(GREEN, 0.1)
color_chase(CYAN, 0.1)
color_chase(BLUE, 0.1)
color_chase(PURPLE, 0.1)
rainbow_cycle(0)
Create the LED
The first thing we'll do is create the LED object. The NeoPixel object has two required arguments and two optional
arguments. You are required to set the pin you're using to drive your NeoPixels and provide the number of pixels you
intend to use. You can optionally set
NeoPixels can be driven by any pin. We've chosen A1. To set the pin, assign the variable
like to use, in our case
board.A1
To provide the number of pixels, assign the variable
example, we're using a strip of
We've chosen to set
brightness=0.3
© Adafruit Industries
# Increase the number to slow down the color chase
# Increase the number to slow down the rainbow
and
brightness
.
.
8
, or 30%.
https://learn.adafruit.com/adafruit-feather-m4-express-atsamd51
.
auto_write
to the number of pixels you'd like to use. In this
num_pixels
to the pin you'd
pixel_pin
Page 135 of 183

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Feather M4 Express and is the answer not in the manual?

Related Products for Adafruit Feather M4 Express

Table of Contents

Save PDF