#define FASTLED_ESP8266_NODEMCU_PIN_ORDER //Uncomment for ESP-12E Boards
#include "FastLED.h"
#define NUM_LEDS 200
#define DATA_PIN 4
#define BRIGHTNESS 255
CRGB leds[NUM_LEDS];
byte mainarray[8][25][3];
byte a8x25[8][25][3];
int DELAY;
//void DM30();
void setup() {
delay(2000);
FastLED.setBrightness( BRIGHTNESS );
DELAY = 110;
FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, NUM_LEDS);
}
void loop()
{
//DM30
for (int u = 0; u < 3; u++) {
DM30();
pt8x25(0, DELAY);
}
shiftsteps8x25(0, DELAY, 8);
//DM34
for (int u = 0; u < 3; u++) {
DM34();
pt8x25(3, DELAY);
}
shiftsteps8x25(3, DELAY, 25);
//DM29
for (int u = 0; u < 3; u++) {
DM29();
pt8x25(3, DELAY);
}
shiftsteps8x25(3, DELAY, 24);
//DM012
DM012(DELAY, 2);
}
void clearmainarray() {
for (byte z1 = 0; z1 < 8; z1++) {
for (byte z2 = 0; z2 < 25; z2++) {
for (byte z3 = 0; z3 < 3; z3++) {
mainarray[z1][z2][z3] = 0;
}
}
}
}
void cleara8x25() {
for (byte z1 = 0; z1 < 8; z1++) {
for (byte z2 = 0; z2 < 25; z2++) {
for (byte z3 = 0; z3 < 3; z3++) {
a8x25[z1][z2][z3] = 0;
}
}
}
}
void display() {
for (byte qq = 0; qq < 25; qq++) {
if (qq % 2 == 0) {
for (byte q = 0; q < 8; q++) {
leds[q + (qq * 8)] = CRGB(mainarray[q][qq][0], mainarray[q][qq][1], mainarray[q][qq][2]);
}
}
else {
for (byte q = 0; q < 8; q++) {
leds[q + (qq * 8)] = CRGB(mainarray[7 - q][qq][0], mainarray[7 - q][qq][1], mainarray[7 - q][qq][2]);
}
}
}
FastLED.show();
}
void up() {
for (byte i = 0; i < 7; i++) {
for (byte j = 0; j < 25; j++) {
mainarray[j][0] = mainarray[i + 1][j][0];
mainarray[j][1] = mainarray[i + 1][j][1];
mainarray[j][2] = mainarray[i + 1][j][2];
}
}
}
void down() {
for (byte i = 7; i > 0; i++) {
for (byte j = 0; j < 25; j++) {
mainarray[j][0] = mainarray[i - 1][j][0];
mainarray[j][1] = mainarray[i - 1][j][1];
mainarray[j][2] = mainarray[i - 1][j][2];
}
}
}
void moveleft() {
for (byte j = 0; j < 24; j++) {
for (byte i = 0; i < 8; i++) {
mainarray[j][0] = mainarray[j + 1][0];
mainarray[j][1] = mainarray[j + 1][1];
mainarray[j][2] = mainarray[j + 1][2];
}
}
}
void moveright() {
for (byte j = 24; j > 0; j--) {
for (byte i = 0; i < 8; i++) {
mainarray[j][0] = mainarray[j - 1][0];
mainarray[j][1] = mainarray[j - 1][1];
mainarray[j][2] = mainarray[j - 1][2];
}
}
}
void setbottomrow(byte x) {
for (byte i = 0; i < 25; i++) {
mainarray[7][0] = a8x25[x][0];
mainarray[7][1] = a8x25[x][1];
mainarray[7][2] = a8x25[x][2];
}
}
void settoprow(byte x) {
for (byte i = 0; i < 25; i++) {
mainarray[0][0] = a8x25[7 - x][0];
mainarray[0][1] = a8x25[7 - x][1];
mainarray[0][2] = a8x25[7 - x][2];
}
}
void setleftcolumn(byte x) {
for (byte i = 0; i < 8; i++) {
mainarray[0][0] = a8x25[24 - x][0];
mainarray[0][1] = a8x25[24 - x][1];
mainarray[0][2] = a8x25[24 - x][2];
}
}
void setrightcolumn(byte x) {
for (byte i = 0; i < 8; i++) {
mainarray[24][0] = a8x25[x][0];
mainarray[24][1] = a8x25[x][1];
mainarray[24][2] = a8x25[x][2];
}
}
void pt8x25(int d, int sp) {
if (d == 0) {
for (byte hh = 0; hh < 8; hh++) {
setbottomrow(hh);
display();
delay(sp);
up();
}
}
if (d == 1) {
for (byte hh = 0; hh < 8; hh++) {
settoprow(hh);
display();
delay(sp);
down();
}
}
else if (d == 2) {
for (byte hh = 0; hh < 25; hh++) {
setrightcolumn(hh);
display();
delay(sp);
moveleft();
}
}
else if (d == 3) {
for (byte hh = 0; hh < 25; hh++) {
setleftcolumn(hh);
display();
delay(sp);
moveright();
}
}
}
void shiftsteps8x25(int d, int sp, byte steps) {
if (d == 0) {
for (byte i = 0 ; i < 25; i++) {
mainarray[7][0] = 0;
mainarray[7][1] = 0;
mainarray[7][2] = 0;
}
for (byte hh = 0; hh < steps; hh++) {
display();
delay(sp);
up();
}
}
if (d == 1) {
for (byte i = 0 ; i < 25; i++) {
mainarray[0][0] = 0;
mainarray[0][1] = 0;
mainarray[0][2] = 0;
}
for (byte hh = 0; hh < steps; hh++) {
display();
delay(sp);
down();
}
}
else if (d == 2) {
for (byte i = 0; i < 8; i++) {
mainarray[24][0] = 0;
mainarray[24][1] = 0;
mainarray[24][2] = 0;
}
for (byte hh = 0; hh < steps; hh++) {
display();
delay(sp);
moveleft();
}
}
else if (d == 3) {
for (byte i = 0 ; i < 8; i++) {
mainarray[0][0] = 0;
mainarray[0][1] = 0;
mainarray[0][2] = 0;
}
for (byte hh = 0; hh < steps; hh++) {
display();
delay(sp);
moveright();
}
}
}