update work (#6)
* Translate and extend getNeighborLED * Rotate function This is so stupid, but we felt pretty clever making it. Pls no haet * Fix led selection to be side independant would only rotate the first side of the cube before! * debrilliantized rotate function Keep it simple stupid * Math is unused * Add missing equal sign That could have screwed up some things dude * Delete semicolon creating error It was a misplaced semicolon * Update work, pair programming yeee
This commit is contained in:
committed by
Daniel Løvbrøtte Olsen
parent
c59c35bafb
commit
4a5bf47fbc
@@ -8,16 +8,27 @@
|
||||
#define BLUE (CRGB) 0x0000FF
|
||||
#define RED (CRGB) 0xFF0000
|
||||
#define GREEN (CRGB) 0x00FF00
|
||||
#define ORANGE (CRGB) 0xFF8C00
|
||||
#define ORANGE (CRGB) 0xFF7000
|
||||
#define WHITE (CRGB) 0xFFFFFF
|
||||
#define YELLOW (CRGB) 0xFFFF00
|
||||
|
||||
CRGB leds[NUM_LEDS];
|
||||
CRGB solution[NUM_LEDS];
|
||||
byte METAROTTODIR[6];
|
||||
|
||||
void rubixRot(byte side, bool dir);
|
||||
|
||||
void setup() {
|
||||
FastLED.addLeds<PL9823, DATA_PIN>(leds, NUM_LEDS);
|
||||
initMap();
|
||||
|
||||
METAROTTODIR[0]=CLOCKW;
|
||||
METAROTTODIR[1]=UP;
|
||||
METAROTTODIR[2]=ACLOCKW;
|
||||
METAROTTODIR[3]=DOWN;
|
||||
METAROTTODIR[4]=LEFT;
|
||||
METAROTTODIR[5]=RIGHT;
|
||||
|
||||
randomSeed(analogRead(0));
|
||||
FastLED.clear();
|
||||
FastLED.show();
|
||||
@@ -72,7 +83,29 @@ void setup() {
|
||||
|
||||
FastLED.show();
|
||||
}
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
|
||||
void loop() {
|
||||
delay(300);
|
||||
rubixRot(random(0, 7), random(0, 1));
|
||||
if (memcmp(leds, solution, sizeof(CRGB) * NUM_LEDS) == 0) {
|
||||
while(true) {
|
||||
setColor({255, 255, 255}, (CRGB) 0x0, leds);
|
||||
delay(200);
|
||||
setColor({255, 255, 255}, GREEN, leds);
|
||||
delay(200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rubixRot(byte side, bool dir){
|
||||
rotate(side, dir, 2, leds);
|
||||
LEDSelect origin = {side, 0, 0};
|
||||
getNeighborLED(&origin, NORTH, &origin);
|
||||
if(dir == 0){
|
||||
new_rotaterot(origin, METAROTTODIR[side], 3, leds);
|
||||
}else{
|
||||
for(byte i = 0; i < 3; i++){
|
||||
rubixRot(side,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user