/*Use the random function to select LED pixel and color, tone, and loop delay */
#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(){
pinMode(A5,OUTPUT); //set the speaker as an output
}
void loop() {
pixels.setPixel(random(0,3),random(0,300)); //Set a random pixel including 0-3 to a random color including 0-299
pixels.draw(); //send the setPixel data to be displayed
tone(A5,random(40,1200)); //play a random tone from 40 to 1199 hertz
delay(random(50,500)); //Wait between 50 and 500 milliseconds before starting the loop over
}
// (c) 2024 Let's Start Coding. License: www.letsstartcoding.com/bsdlicense
It looks like your computer isn't set up to code yet.
Success!
Compile errors:
Serial port monitor:
Input:
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!
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!