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{{0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, {0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, {0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, {0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}},
|
|
|
|
{{0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1}, {0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1}, {0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1}, {0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1}},
|
2019-08-05 20:33:53 -04:00
|
|
|
|
2022-09-20 21:29:50 -04:00
|
|
|
{{0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,1}, {0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,1}, {0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,1}, {0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,1}},
|
|
|
|
{{0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,1}, {0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,1}, {0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,1}, {0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,1}},
|
|
|
|
{{1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1}, {1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1}, {1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1}, {1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1}},
|
2019-08-05 20:33:53 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
void setup(){
|
2022-09-20 21:29:50 -04:00
|
|
|
pinMode(0, OUTPUT);
|
|
|
|
pinMode(1, OUTPUT);
|
|
|
|
pinMode(2, OUTPUT);
|
|
|
|
pinMode(3, OUTPUT);
|
|
|
|
pinMode(4, OUTPUT);
|
|
|
|
pinMode(5, OUTPUT);
|
|
|
|
pinMode(6, OUTPUT);
|
|
|
|
pinMode(7, OUTPUT);
|
|
|
|
pinMode(8, OUTPUT);
|
|
|
|
pinMode(9, OUTPUT);
|
|
|
|
pinMode(10, OUTPUT);
|
|
|
|
pinMode(11, OUTPUT);
|
|
|
|
pinMode(12, OUTPUT);
|
|
|
|
pinMode(13, OUTPUT);
|
|
|
|
pinMode(A0, OUTPUT);
|
|
|
|
pinMode(A1, OUTPUT);
|
|
|
|
pinMode(A2, OUTPUT);
|
|
|
|
pinMode(A3, OUTPUT);
|
|
|
|
pinMode(A4, OUTPUT);
|
|
|
|
pinMode(A5, OUTPUT);
|
2019-08-05 20:33:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop(){
|
2022-09-20 21:29:50 -04:00
|
|
|
for (byte i = 0; i < sizeof(animation)/sizeof(animation[0]); ++i){
|
|
|
|
long time = millis();
|
|
|
|
while (millis() - time <= 100){
|
|
|
|
for (byte x = 0; x < 4; ++x){
|
|
|
|
state(animation[i][x], x, true);
|
|
|
|
state(animation[i][x], x, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-05 20:33:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void state(boolean frame[], byte layer, boolean state){
|
2022-09-20 21:29:50 -04:00
|
|
|
switch (layer){
|
|
|
|
case 0:
|
|
|
|
digWrite(16, !state);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
digWrite(17, !state);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
digWrite(18, !state);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
digWrite(19, !state);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < 16; ++i){
|
|
|
|
if (frame[i]) {
|
|
|
|
digWrite(i, state);
|
|
|
|
}
|
|
|
|
}
|
2019-08-05 20:33:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void digWrite(byte pin, boolean state){
|
2022-09-20 21:29:50 -04:00
|
|
|
if (state) {
|
|
|
|
digitalWrite(pin, HIGH);
|
|
|
|
} else {
|
|
|
|
digitalWrite(pin, LOW);
|
|
|
|
}
|
2019-08-05 20:33:53 -04:00
|
|
|
}
|