Skip to main content Black Lives Matter Education & Workshop Kit Arduino NeoPixel Rainbow
Overview
Guided Tour
CircuitPython
Blink
Sound Reactive NeoPixels
Capacitive Touch
Arduino IDE Setup
Using with Arduino IDE
Adapting Sketches to M0 & M4
Arduino Blink
Arduino NeoPixel Rainbow
Downloads
Single page
Feedback? Corrections?
Text View
Primary Products
Your browser does not support the video tag. Black Lives Matter Education & Workshop Kit Out of Stock
5 Beginner Product guide
Arduino NeoPixel Rainbow
The BLM Badge comes with six side-lit NeoPixel LEDs around the edge of the board. These RGB NeoPixel LEDs can be used to create all the colors of the rainbow and everything in between. The following example displays a flowing rainbow across all the LEDs.
NeoPixel
You'll need to install one library in Arduino for this example to work. Open the Arduino IDE. Click Arduino > Sketch > Include library... > Manage Libraries, then type 'neopixel' in the search box. Install the library shown here.
Code
In the Arduino IDE, create a new sketch by clicking File > New
Then, copy the code shown below and paste it into the new sketch.
First you include the NeoPixel library you installed.
Next, you tell the code you have 6 NeoPixels, and the pin they are on. Then, you declare the NeoPixel object using the info you provided.
In setup, you initialise the NeoPixel strip object, make sure the LEDs begin turned off, and set the brightness to approximately 1/5 maximum (max is 255). These LEDs are really bright at max!
In the loop, we run the rainbow code with a 10ms delay. Increase this number to slow down the rainbow.
Finally, we have the rainbow code, which requires you to provide a wait time in milliseconds.
That's all there is to making NeoPixel rainbows with Arduino and the BLM badge!
Page last edited March 08, 2024
Text editor powered by tinymce.
Arduino Blink Downloads Related Guides Navi10 MacroPad with KB2040 and KMK CircuitPython... By Eva Herrada beginner HalloWing Interactive Cat Toy By Dave Astels intermediate Control Wiz Lights With CircuitPython By Tim C beginner Adafruit PiUART - USB Console and Power Add-on for... By lady ada beginner Adafruit Metro M4 Express featuring ATSAMD51 By lady ada beginner Adafruit SHT31-D Temperature & Humidity Sensor Breakout By lady ada intermediate Bluetooth TV Zapper By John Park beginner Adafruit A4988 Stepper Motor Driver Breakout Board By Liz Clark beginner Adafruit Rotary Trinkey By Kattni Rembor beginner Theme Park Wait Time Display By Ruiz Brothers beginner Your browser does not support the video tag. This links to the guide Dune Worm Thumper. Dune Worm Thumper By Ruiz Brothers beginner 3D Printed LED Knuckle Jewelry By Ruiz Brothers beginner Your browser does not support the video tag. This links to the guide 3D-Printed Bionic Eye. 3D-Printed Bionic Eye By Bill Earl beginner Adafruit RFM69HCW and RFM9X LoRa Packet Radio Breakouts By lady ada intermediate Ladyada's Toolkit By Erin St Blaine beginner