/* Arduino 256 RGB LEDs Matrix Animation Frame
* Using WS2812 LED Strips
FastLED routine Created by Yvan / https://Brainy-Bits.com
Fully Optimised by Crazydoub
const long Mario[][256] PROGMEM ={
{0x252323, 0x252323, 0x252323, 0x000000, 0xff0000, 0xff0000, 0xff0000, 0xff0000,
0xff0000, 0xff0000, 0xff0000, 0xff0000, 0x000000, 0x252323, 0x252323, 0x252323,
0x252323, 0x252323, 0x252323, 0x000000, 0x5f2e11, 0x5f2e11, 0x5f2e11, 0xe0a680,
0xe0a680, 0xe0a680, 0x5f2e11, 0xe0a680, 0x5f2e11, 0x000000, 0x252323, 0x252323,
0x252323, 0x252323, 0x000000, 0x5f2e11, 0xe0a680, 0x5f2e11, 0xe0a680, 0xe0a680,
0xe0a680, 0xe0a680, 0xe0a680, 0x5f2e11, 0x5f2e11, 0x000000, 0x252323, 0x252323,
0x252323, 0x252323, 0x252323, 0x252323, 0x000000, 0xe0a680, 0xe0a680, 0xe0a680,
0xff0000, 0x4200ff, 0xff0000, 0xff0000, 0x000000, 0x252323, 0x252323, 0x252323,
0xff0000, 0xff0000, 0xff0000, 0xff0000, 0x000000, 0x000000, 0x000000, 0x252323,
0x000000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000,
0xe0a680, 0x000000, 0xe0a680, 0xe0a680, 0x000000, 0x000000, 0x000000, 0x252323,
0x252323, 0x252323, 0x000000, 0xe0a680, 0xe0a680, 0xe0a680, 0x000000, 0xe0a680,
0xe0a680, 0xe0a680, 0x000000, 0xe0a680, 0xe0a680, 0xe0a680, 0x000000, 0x252323,
0x252323, 0x252323, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xe0a680,
0xe0a680, 0xe0a680, 0xe0a680, 0xe0a680, 0xe0a680, 0x000000, 0x252323, 0x252323,
0x252323, 0x252323, 0x252323, 0x000000, 0x000000, 0x4200ff, 0xff0000, 0xff0000,
0x252323, 0x252323, 0x000000, 0xff0000, 0xff0000, 0xff0000, 0x4200ff, 0xff0000,
0x4200ff, 0x4200ff, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0x000000, 0x252323,
0x252323, 0x000000, 0xe0a680, 0xe0a680, 0xff0000, 0x4200ff, 0xffc600, 0x4200ff,
0x4200ff, 0x4200ff, 0x4200ff, 0xe0a680, 0xe0a680, 0xe0a680, 0x000000, 0x252323,
0x252323, 0x000000, 0xe0a680, 0xe0a680, 0x4200ff, 0x4200ff, 0x4200ff, 0x000000,
0x000000, 0x4200ff, 0x4200ff, 0x4200ff, 0x000000, 0x000000, 0x252323, 0x252323,
0x252323, 0x252323, 0x000000, 0x5f2e11, 0x5f2e11, 0x5f2e11, 0x5f2e11, 0x000000,
0x000000, 0x5f2e11, 0x5f2e11, 0x5f2e11, 0x5f2e11, 0x5f2e11, 0x000000, 0x252323,
0xff0000, 0x4200ff, 0xff0000, 0xff0000, 0xff0000, 0x000000, 0x252323, 0x252323,
0x252323, 0x000000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0x4200ff, 0x4200ff,
0x4200ff, 0xffc600, 0x4200ff, 0xff0000, 0xe0a680, 0xe0a680, 0x000000, 0x252323,
0x252323, 0x000000, 0xe0a680, 0xe0a680, 0xe0a680, 0x4200ff, 0x4200ff, 0x4200ff,
0x000000, 0x4200ff, 0x4200ff, 0x4200ff, 0xe0a680, 0xe0a680, 0x000000, 0x252323,
0x252323, 0x252323, 0x000000, 0x000000, 0x4200ff, 0x4200ff, 0x4200ff, 0x000000,
0x000000, 0x5f2e11, 0x5f2e11, 0x5f2e11, 0x5f2e11, 0x000000, 0x252323, 0x252323,
0x252323, 0x000000, 0x5f2e11, 0x5f2e11, 0x5f2e11, 0x5f2e11, 0x5f2e11, 0x000000},
{
0x252323, 0x252323, 0x252323, 0x252323, 0x252323, 0x000000, 0xff0000, 0xff0000,
0xff0000, 0xff0000, 0xff0000, 0x000000, 0x252323, 0x252323, 0x252323, 0x252323,
0x252323, 0x252323, 0x252323, 0x252323, 0x000000, 0x5f2e11, 0x5f2e11, 0x5f2e11,
0xe0a680, 0x5f2e11, 0xe0a680, 0x5f2e11, 0x000000, 0x252323, 0x252323, 0x252323,
0x252323, 0x252323, 0x252323, 0x000000, 0x5f2e11, 0xe0a680, 0x5f2e11, 0x5f2e11,
0xe0a680, 0xe0a680, 0x5f2e11, 0x5f2e11, 0x000000, 0x252323, 0x252323, 0x252323,
0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xe0a680, 0xe0a680,
0x4200ff, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xe0a680, 0xe0a680, 0xe0a680,
0xff0000, 0xff0000, 0xff0000, 0x000000, 0x000000, 0xe0a680, 0xe0a680, 0xe0a680,
0xe0a680, 0xe0a680, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000,
0xe0a680, 0xe0a680, 0x000000, 0xe0a680, 0x252323, 0xff0000, 0xff0000, 0xff0000,
0xff0000, 0xff0000, 0xe0a680, 0xe0a680, 0xe0a680, 0x000000, 0xe0a680, 0xe0a680,
0xe0a680, 0xe0a680, 0xe0a680, 0x000000, 0xe0a680, 0xe0a680, 0xe0a680, 0xff0000,
0x000000, 0xff0000, 0x000000, 0x000000, 0x000000, 0x000000, 0xe0a680, 0xe0a680,
0xe0a680, 0xe0a680, 0xe0a680, 0xe0a680, 0xe0a680, 0xff0000, 0xff0000, 0x000000,
0x000000, 0x000000, 0xff0000, 0xff0000, 0x4200ff, 0xff0000, 0xff0000, 0xff0000,
0xe0a680, 0xe0a680, 0xe0a680, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000,
0x4200ff, 0xff0000, 0xff0000, 0xff0000, 0x000000, 0x000000, 0x000000, 0x000000,
0x252323, 0x252323, 0x252323, 0x000000, 0x000000, 0x4200ff, 0x4200ff, 0x4200ff,
0x4200ff, 0x4200ff, 0x4200ff, 0x5f2e11, 0x5f2e11, 0x000000, 0x252323, 0x252323,
0x252323, 0x000000, 0x5f2e11, 0x5f2e11, 0x5f2e11, 0x4200ff, 0x4200ff, 0x4200ff,
0x000000, 0x000000, 0x000000, 0x000000, 0x5f2e11, 0x5f2e11, 0x000000, 0x252323,
0x252323, 0x252323, 0x000000, 0x000000, 0x252323, 0x252323, 0x252323, 0x252323,
0x252323, 0x252323, 0x252323, 0x252323, 0x252323, 0x252323, 0x252323, 0x252323,
0x4200ff, 0xff0000, 0xff0000, 0xff0000, 0x4200ff, 0x000000, 0x000000, 0x5f2e11,
0x5f2e11, 0x4200ff, 0x4200ff, 0xffc600, 0x4200ff, 0x4200ff, 0x4200ff, 0x4200ff,
0x4200ff, 0xffc600, 0x4200ff, 0x4200ff, 0x4200ff, 0x4200ff, 0x4200ff, 0x5f2e11,
0x5f2e11, 0x4200ff, 0x4200ff, 0x4200ff, 0x4200ff, 0x4200ff, 0x4200ff, 0x4200ff,
0x4200ff, 0x4200ff, 0x4200ff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
0x252323, 0x252323, 0x252323, 0x252323, 0x252323, 0x000000, 0x000000, 0x000000,
0x252323, 0x252323, 0x252323, 0x252323, 0x252323, 0x252323, 0x252323, 0x252323,
0x252323, 0x252323, 0x252323, 0x252323, 0x252323, 0x252323, 0x252323, 0x252323}};
#include
#include "FastLED.h"
#define NOMBRE_DE_LEDS 256
#define PIN_DE_L_ARDUINO 2
#define LUMINOSITE 20 // Connected to the data pin of the first LED strip
// Define the array of leds
CRGB leds[NOMBRE_DE_LEDS];
void setup() {
FastLED.addLeds(leds, NOMBRE_DE_LEDS); // Init of the Fastled library
FastLED.setBrightness(0);
Serial.begin(9600);
}
void fadeout(){
for(int i=LUMINOSITE; i>0; i--) { // Display it 8 times
FastLED.setBrightness(i);
FastLED.show();
delay(5);}
FastLED.clear();
}
void fadein(){
for(int i=0; i<=LUMINOSITE; i++) { // Display it 8 times
FastLED.setBrightness(i);
FastLED.show();
delay(5);}
}
void afficher(const long ANIMATION[][256], int NOMBRE_DE_SPRITES, int DELAI_ENTRE_SPRITES, int NB_REPETITIONS){
int k=0;
for(int i = 0; i < NOMBRE_DE_LEDS; i++) {leds[i] = pgm_read_dword(&(ANIMATION[0][i])); }
FastLED.show();
fadein();
while( k‹NB_REPETITIONS){
for(int j = 0; j < NOMBRE_DE_SPRITES; j++) { //Compteur de sprites
FastLED.clear();
for(int i = 0; i < NOMBRE_DE_LEDS; i++) {
leds[i] = pgm_read_dword(&(ANIMATION[j][i])); //Remplissage avec la sprite en cours
}
FastLED.show(); //Affichage de la sprite
delay(DELAI_ENTRE_SPRITES);
}
k++;
}
fadeout();
}
void loop() {
//afficher (Array, Nombre de sprites, délai images, répétitions);
afficher(Mario,2,500,4);
}