Update rubix.ino
This commit is contained in:
parent
94ab8c914b
commit
80823df95e
@ -16,57 +16,63 @@ CRGB leds[NUM_LEDS];
|
|||||||
CRGB solution[NUM_LEDS];
|
CRGB solution[NUM_LEDS];
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
FastLED.addLeds<PL9823, DATA_PIN>(leds, NUM_LEDS);
|
FastLED.addLeds<PL9823, DATA_PIN>(leds, NUM_LEDS);
|
||||||
initMap();
|
initMap();
|
||||||
randomSeed(analogRead(0));
|
randomSeed(analogRead(0));
|
||||||
FastLED.clear();
|
FastLED.clear();
|
||||||
FastLED.show();
|
FastLED.show();
|
||||||
|
|
||||||
// Make the solution memory structure
|
// Make the solution memory structure
|
||||||
setColor({0, 255, 255}, BLUE, solution);
|
setColor({0, 255, 255}, BLUE, solution);
|
||||||
setColor({1, 255, 255}, RED, solution);
|
setColor({1, 255, 255}, RED, solution);
|
||||||
setColor({2, 255, 255}, GREEN, solution);
|
setColor({2, 255, 255}, GREEN, solution);
|
||||||
setColor({3, 255, 255}, ORANGE, solution);
|
setColor({3, 255, 255}, ORANGE, solution);
|
||||||
setColor({4, 255, 255}, WHITE, solution);
|
setColor({4, 255, 255}, WHITE, solution);
|
||||||
setColor({5, 255, 255}, YELLOW, solution);
|
setColor({5, 255, 255}, YELLOW, solution);
|
||||||
|
|
||||||
setColor({0, 1, 1}, BLUE, leds);
|
|
||||||
setColor({1, 1, 1}, RED, leds);
|
|
||||||
setColor({2, 1, 1}, GREEN, leds);
|
|
||||||
setColor({3, 1, 1}, ORANGE, leds);
|
|
||||||
setColor({4, 1, 1}, WHITE, leds);
|
|
||||||
setColor({5, 1, 1}, YELLOW, leds);
|
|
||||||
|
|
||||||
for (byte i = 0; i < 6; i++) {
|
setColor({0, 1, 1}, BLUE, leds);
|
||||||
for (byte j = 0; j < 8; j++) {
|
setColor({1, 1, 1}, RED, leds);
|
||||||
byte selection;
|
setColor({2, 1, 1}, GREEN, leds);
|
||||||
do {
|
setColor({3, 1, 1}, ORANGE, leds);
|
||||||
selection = random(0, NUM_LEDS);
|
setColor({4, 1, 1}, WHITE, leds);
|
||||||
}
|
setColor({5, 1, 1}, YELLOW, leds);
|
||||||
while (leds[selection] != (CRGB) 0x000000);
|
|
||||||
|
for (byte i = 0; i < 6; i++) {
|
||||||
|
FastLED.show();
|
||||||
|
delay(500);
|
||||||
|
for (byte j = 0; j < 8; j++) {
|
||||||
|
byte selection;
|
||||||
|
do {
|
||||||
|
selection = random(0, NUM_LEDS);
|
||||||
|
}
|
||||||
|
while (leds[selection] != (CRGB) 0x000000);
|
||||||
|
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 0:
|
case 0:
|
||||||
leds[selection] = BLUE;
|
leds[selection] = BLUE;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
leds[selection] = RED;
|
leds[selection] = RED;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
leds[selection] = GREEN;
|
leds[selection] = GREEN;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
leds[selection] = ORANGE;
|
leds[selection] = ORANGE;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
leds[selection] = WHITE;
|
leds[selection] = WHITE;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
leds[selection] = YELLOW;
|
leds[selection] = YELLOW;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FastLED.show();
|
|
||||||
|
FastLED.show();
|
||||||
|
}
|
||||||
|
void loop() {
|
||||||
|
// put your main code here, to run repeatedly:
|
||||||
|
|
||||||
}
|
}
|
||||||
void loop() {}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user