#include <Adafruit_GFX.h>
#include <FastLED.h>
#include <FastLED_NeoMatrix.h>
//==============================================
#define PIN 3
#define mw 32
#define mh 8
//==============================================
int i,k,m,z,l;
int j=0;
#define NUMMATRIX (mw*mh)
CRGB matrixleds[NUMMATRIX];
FastLED_NeoMatrix *matrix = new FastLED_NeoMatrix(matrixleds, mw, mh, 1, 1, NEO_MATRIX_TOP + NEO_MATRIX_LEFT + NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG );
byte COLORS1[3][3] = { {0xff, 0, 0 },
{0, 0xff, 0 },
{0, 0, 0xff } };
const uint16_t colors[] = { matrix->Color(255, 0, 0), matrix->Color(0, 255, 0), matrix->Color(0, 0, 255),matrix->Color(255, 0, 255), matrix->Color(0, 255, 255), matrix->Color(255, 255, 0) };
#define NoColor 6
#define FRAMES_PER_SECOND 60
unsigned long old =0;
unsigned long current =0;
const long interval = 5;
bool gReverseDirection = false;
byte *d;
int pass = 0;
void setup()
{
Serial.begin(115200);
FastLED.addLeds<NEOPIXEL,PIN>(matrixleds, NUMMATRIX);
matrix->begin();
matrix->setTextWrap(false);
matrix->setBrightness(255);
matrix->fillScreen(0);
matrix->show();
delay(100);
}
int x = mw;
int y = mh;
void loop()
{
Effect5(); Serial.println("Design 3 Completed");
}
void setPixel(int Pixel, byte red, byte green, byte blue)
{
#ifdef ADAFRUIT_NEOPIXEL_H // NeoPixel
strip.setPixelColor(Pixel, strip.Color(red, green, blue));
#endif
#ifndef ADAFRUIT_NEOPIXEL_H // FastLED
matrixleds[Pixel].r = red;
matrixleds[Pixel].g = green;
matrixleds[Pixel].b = blue;
#endif
}
void setAll(byte red, byte green, byte blue)
{
for(int i = 0; i < NUMMATRIX; i++ )
{
setPixel(i, red, green, blue);
}
FastLED.show();
}
//===============================================================================
void Effect5()
{
int Speed_Delay=10;
current=millis();
old=current;
setAll(0,0,0);
Serial.println("Effect 3 running");
while ( (current-old)/1000 < interval)
{
for(l=0;l<NoColor; l=l+1)
{
for(j=0;j<x/10*10; j=j+10)
{
matrix->drawLine(j,1,j,3,colors[0]);
matrix->drawLine(j,4,j+3,7,colors[0]);
matrix->drawLine(j+3,7,j+6,4,colors[0]);
matrix->drawLine(j+6,1,j+6,3,colors[0]);
matrix->drawLine(j+1,0,j+2,0,colors[0]);
matrix->drawLine(j+4,0,j+5,0,colors[0]);
matrix->drawLine(j+3,1,j+3,1,colors[0]);
matrix->show();
}
}
current=millis();
}
}
//===============================================================================