#include <FastLED.h>
#define COLOR_ORDER RGB
#define CHIPSET APA102
#define BRIGHTNESS 64
uint32_t Col = 0x55ff55;
uint32_t br_flag = 0xff;
uint32_t Col_br = 0;
// Params for width and height
const uint8_t kMatrixWidth = 20;
const uint8_t kMatrixHeight = 14;
uint32_t belflag[] = {
0xF800,0xF820,0xF8C0,0xF9E0,0xFB40,0xF4E1,0xF641,
0xF721,0xFFA0,0xFFC0,0xEF40,0xC620,0x9481,0x5AC1,
0x2941,0x0861,0x0000,0x0000,0x0000,0x0000,0xF800,
0xF840,0xF8E0,0xFA20,0xFBC0,0xFD60,0xF6C1,0xFF80,
0xFFC0,0xFFC0,0xE720,0xBDE0,0x8420,0x4A40,0x18E0,
0x0840,0x0000,0x0000,0x0000,0x0000,0xF800,0xF840,
0xF920,0xFA80,0xFC40,0xFDE0,0xFF20,0xFFA0,0xFFE0,
0xFFC0,0xE700,0xB5A0,0x7BE0,0x4220,0x18C0,0x0020,
0x0000,0x0000,0x0000,0x0000,0xF800,0xF840,0xF920,
0xFAA0,0xFC60,0xFE00,0xFF40,0xFFC0,0xFFE0,0xFFC0,
0xDEE0,0xAD60,0x73A0,0x39C0,0x10A0,0x0020,0x0000,
0x0000,0x0000,0x0000,0xF800,0xF840,0xF940,0xFAC0,
0xFC80,0xFE40,0xFF60,0xFFC0,0xFFE0,0xFFC0,0xE700,
0xAD60,0x7380,0x39C0,0x10A0,0x0020,0x0000,0x0000,
0x0000,0x0000,0xF800,0xF820,0xF900,0xFAC0,0xFC80,
0xFE20,0xFF40,0xFFC0,0xFFE0,0xF7A0,0xDEE0,0xAD40,
0x6B60,0x31A0,0x1080,0x0020,0x0000,0x0000,0x0000,
0x0000,0xF800,0xF820,0xF900,0xFAA0,0xFC80,0xFE40,
0xFF60,0xFFC0,0xFFE0,0xFFC0,0xE700,0xAD60,0x6B60,
0x31A0,0x1080,0x0000,0x0000,0x0000,0x0000,0x0000,
0xF800,0xF820,0xF8E0,0xFA80,0xFC60,0xFE20,0xFF40,
0xFFC0,0xFFE0,0xFFC0,0xE700,0xAD40,0x6B60,0x31A0,
0x1080,0x0020,0x0000,0x0000,0x0000,0x0000,0xF800,
0xF820,0xF8E0,0xFA60,0xFC40,0xFE20,0xFF40,0xFFC0,
0xFFE0,0xFFC0,0xE700,0xAD40,0x6B60,0x39C0,0x1080,
0x0000,0x0000,0x0000,0x0000,0x0000,0xF800,0xF800,
0xF8C0,0xFA40,0xFC20,0xFDE0,0xFF20,0xFFC0,0xFFE0,
0xFFC0,0xE700,0xAD60,0x7380,0x39C0,0x1080,0x0020,
0x0000,0x0000,0x0000,0x0000,0xF800,0xF800,0xF8A0,
0xFA20,0xFC00,0xFDE0,0xFF00,0xFFA0,0xFFE0,0xFFC0,
0xDEE0,0xAD60,0x73A0,0x39E0,0x10A0,0x0020,0x0000,
0x0000,0x0000,0x0000,0xF800,0xF800,0xF8A0,0xFA00,
0xFBC0,0xFDA0,0xFEE0,0xFFA0,0xFFE0,0xFFC0,0xE700,
0xB580,0x7BC0,0x4200,0x18C0,0x0020,0x0000,0x0000,
0x0000,0x0000,0xF800,0xF800,0xF8A0,0xF9E0,0xFBA0,
0xFD60,0xFEC0,0xFF80,0xFFE0,0xFFC0,0xE700,0xB5A0,
0x7BE0,0x4A40,0x18E0,0x0840,0x0000,0x0000,0x0000,
0x0000,0xF800,0xF800,0xF880,0xF9A0,0xFB40,0xFD00,
0xFE80,0xFF60,0xFFC0,0xF7A0,0xE720,0xBDE0,0x8C40,
0x5280,0x2120,0x0840,0x0000,0x0000,0x0000,0x0000
};
//
#define NUM_LEDS (kMatrixWidth * kMatrixHeight)
CRGB leds[kMatrixWidth * kMatrixHeight];
CRGB ledstemp[kMatrixWidth * kMatrixHeight];
#define LAST_VISIBLE_LED 279
uint16_t XY( uint16_t x, uint16_t y)
{
// any out of bounds address maps to the first hidden pixel
if( (x >= kMatrixWidth) || (y >= kMatrixHeight) ) {
return (LAST_VISIBLE_LED + 1);
}
const uint16_t ShadesTable[] = {
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,
40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,
79,78,77,76,75,74,73,72,71,70,69,68,67,66,65,64,63,62,61,60,
80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,
119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,
120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,
159,158,157,156,155,154,153,152,151,150,149,148,147,146,145,144,143,142,141,140,
160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,
199,198,197,196,195,194,193,192,191,190,189,188,187,186,185,184,183,182,181,180,
200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,
239,238,237,236,235,234,233,232,231,230,229,228,227,226,225,224,223,222,221,220,
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,
279,278,277,276,275,274,273,272,271,270,269,268,267,266,265,264,263,262,261,260,
};
uint16_t i = (y * kMatrixWidth) + x;
uint16_t j = ShadesTable[i];
return j;
}
void loop()
{
//Belgian_flag2();
Belgian_flag();
//FastLED.show();
}
void Belgian_flag(){
for(int x = 0; x < kMatrixWidth; x++){
{
for( int y = 0; y < kMatrixHeight; y++){
for(int i = 0; i<NUM_LEDS; i++ ) {
// Col = belflag[i] ;
// Col_br = ( br_flag << 24 | Col );
// leds[ XY(x, y)]= CRGB(Col);
memmove8( &leds[XY(x,y)], &belflag[i],10 * sizeof (CRGB));
FastLED.show() ;
}
}
}
}
}
void setup() {
FastLED.addLeds<CHIPSET, 5,4, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalSMD5050);
FastLED.setBrightness( BRIGHTNESS );
}
// apart off the whole code , but works on its own
//array is 280 pixels apa 102 and on the moment there is a xy matrix as //the pixels will not be aligned ( used the xy spread factor )
i only want to show flag image on my led screen , very basic i’m using a teensy 3.1 for memory and faster results
regards