02 Blink All Rainbow LED Pixels

Blink All LED Pixels

/* Blink all of the rainbow pixels on and off once per second */ #include "LEDStrip.h" //The LEDStrip.h library gives your code access to special functions exclusive to the LED pixels LEDStrip pixels = LEDStrip(3, 13, 12); //Set up the pixels by defining how many pixels (3) and where the pixels connect to the microchip //The info inside these parentheses will never change when using Bumblebee void setup() {}//nothing needed in the setup! void loop() { pixels.setPixel(pixels.All, 200); //use pixels.All in the place where the pixel number normally goes, then the color (0-300) pixels.draw(); //Send the setPixel values to Bumblebee delay(1000); //Wait 1000 milliseconds (1 second) with the pixels lit up pixels.clear(); //pixels.clear() sets all the pixels to have no color value (turned off) pixels.draw(); //Send the pixels.clear() values to Bumblebee delay(1000); //Wait 1000 milliseconds before starting the loop again } // (c) 2024 Let's Start Coding. License: www.letsstartcoding.com/bsdlicense
 

Walkthrough Video

Watch the video for a line-by-line explanation of how the example program works. Then you'll be ready to make some changes of your own!

LED Pixel Color Spectrum


Use this spectrum to estimate the color values you'll need for your 'setPixel' arguments to achieve your favorite color!


 

Challenges

Can you complete the challenges? Change the code in your code editor above. Upload your code to see the effect when you're finished. Complete a challenge? Check it off the list!

TRANSFORMERS and HASBRO and all related trademarks and logos are trademarks of Hasbro, Inc. ©2024 Hasbro.