My Candy Program


#1

I have a huge program. This should show pastel lights when it turns on, and blink candy colors. It will loop, repeat, and buzz throughout the program.
Here is a video:

It doesn’t show all of it…
Here is the code:
LED led;
Timer timer;
Buzzer buzz;
void setup() {
// put your setup code here, to run once:
led.setLight(0,102,205,170);
led.setLight(1,186,85,211);
led.setLight(2,32,178,170);
led.setLight(3,221,160,221);
buzz.short_buzz();
}

void loop() {
// put your main code here, to run repeatedly:

}

void button_press(void) {
for (int i = 0; i < 20; i++){
LED led;
buzz.short_buzz();
led.setLight(0,102,205,170);
led.setLight(1,32,178,170);
led.setLight(2,32,178,170);
led.setLight(3,221,160,221);
timer.pause(1000);
led.turn_off_all();
led.setLight(0,255,218,185);
led.setLight(1,255,250,205);
led.setLight(2,230,230,250);
led.setLight(3,255,228,225);
timer.pause(1000);
led.turn_off_all();
led.setLight(0,240,255,255);
led.setLight(1,240,255,240);
led.setLight(2,255,250,240);
led.setLight(3,255,240,245);
timer.pause(1000);
led.turn_off_all();
led.setLight(0,135,206,235);
led.setLight(1,102,205,170);
led.setLight(2,175,238,238);
led.setLight(3,255,250,205);
timer.pause(1000);
led.turn_off_all();
led.setLight(0,240,255,255);
timer.pause(1000);
led.turn_off_all();
buzz.short_buzz();
led.setLight(1,186,85,211);
led.setLight(2,32,178,170);
timer.pause(1000);
led.turn_off_all();
led.setLight(1,240,255,240);
timer.pause(3000);
led.turn_off_all();
led.setLight(1,255,240,245);
led.setLight(3,240,255,240);
timer.pause(3000);
led.turn_off_all();
led.setLight(0,245,255,250);
led.setLight(3,255,245,238);
timer.pause(3000);
led.turn_off_all();
buzz.short_buzz();
led.setLight(2,255,250,205);
timer.pause(3000);
led.turn_off_all();
led.setLight(0,135,206,235);
led.setLight(1,102,205,170);
led.setLight(2,255,250,205);
led.setLight(3,255,192,203);
buzz.extra_long_buzz();
led.setLight(0,102,205,170);
led.setLight(1,32,178,170);
led.setLight(2,32,178,170);
led.setLight(3,221,160,221);
buzz.short_buzz();
led.setLight(0,102,205,170);
led.setLight(1,32,178,170);
led.setLight(2,32,178,170);
led.setLight(3,221,160,221);
timer.pause(1000);
led.turn_off_all();
led.setLight(0,255,218,185);
led.setLight(1,255,250,205);
led.setLight(2,230,230,250);
led.setLight(3,255,228,225);
timer.pause(1000);
led.turn_off_all();
led.setLight(0,240,255,255);
led.setLight(1,240,255,240);
led.setLight(2,255,250,240);
led.setLight(3,255,240,245);
timer.pause(1000);
led.turn_off_all();
led.setLight(0,135,206,235);
led.setLight(1,102,205,170);
led.setLight(2,175,238,238);
led.setLight(3,255,250,205);
timer.pause(1000);
led.turn_off_all();
timer.pause(1000);
led.turn_off_all();
buzz.short_buzz();
led.setLight(1,186,85,211);
led.setLight(2,240,128,128);
timer.pause(1000);
led.turn_off_all();
led.setLight(1,240,255,240);
timer.pause(3000);
led.turn_off_all();
led.setLight(1,255,240,245);
led.setLight(3,240,255,240);
timer.pause(1000);
led.turn_off_all();
timer.pause(1000);
led.turn_off_all();
led.setLight(0,255,218,185);
led.setLight(1,255,250,205);
led.setLight(2,230,230,250);
led.setLight(3,255,228,225);
timer.pause(1000);
led.turn_off_all();
led.setLight(0,240,255,255);
led.setLight(1,2245,255,250);
led.setLight(2,255,250,240);
led.setLight(3,255,240,245);
timer.pause(1000);
led.turn_off_all();
led.setLight(0,135,206,235);
led.setLight(1,102,205,170);
led.setLight(2,175,238,238);
led.setLight(3,240,248,255);
timer.pause(1000);
led.turn_off_all();
timer.pause(1000);
led.turn_off_all();
buzz.short_buzz();
led.setLight(1,186,85,211);
led.setLight(2,32,178,170);
timer.pause(1000);
led.turn_off_all();
led.setLight(1,240,255,240);
timer.pause(3000);
led.setLight(0,245,255,250);
led.setLight(3,240,128,128);
timer.pause(3000);
led.turn_off_all();
led.setLight(0,135,206,235);
led.setLight(1,102,205,170);
led.setLight(2,255,250,205);
led.setLight(3,255,192,203);
led.setLight(0,240,255,255);
timer.pause(1000);
led.setLight(0,127,255,212);
led.setLight(1,0,250,154);
led.setLight(2,255,215,0);
led.setLight(3,176,224,230);
timer.pause(1000);
}
}


#2

This is amazing!


#3

WOW, I can’t believe you are using the setLight function. That’s in the firmware! I’m going to upload this onto a bot today and wear it!


#4

Can you pick two favorite colors to make a permanent part of the library? I will add when putting in orange! If you like, you can name them as well.