DJ Namaste
Active member
The code below is my attempt. It is displaying a heart in the first 16 pixels and below that there is the same colors blinking but out of order. It is a 16x16 file. I made a new space for the pixel length to be defined. Not sure what I am doing wrong.
#include "FastLED.h"
#define NUM_LEDS 32
#define DATA_PIN 17
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
}
const unsigned int array0[] = { 0x000000, 0x000000, 0x000000, 0x1d0f0d, 0xd83c30, 0x000201, 0x000000, 0x000000, 0x000000, 0x000000, 0xdb3f37, 0xdb3a2f, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xd4392d, 0xd3392d, 0xd3392d, 0xd3392d, 0x040204, 0x000000, 0x000000, 0xd3392d, 0xd3392d, 0xd3392d, 0xd3392d, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xd2382c, 0xd2382c, 0xd2382c, 0xd2382c, 0xd2382c, 0x000000, 0xd23a2c, 0xd2382c, 0xd2382c, 0xd2382c, 0xd2382c, 0xd1392c, 0x000000, 0x000000, 0x000000, 0xa94843, 0xd1372b, 0xd1372b, 0xd1372b, 0xd1372b, 0xd1372b, 0xc14036, 0xd1372b, 0xd1372b, 0xd1372b, 0xd1372b, 0xd1372b, 0xd1372b, 0x000000, 0x000000, 0x000000, 0xce3629, 0xce372c, 0xce372c, 0xce372c, 0xce372c, 0xce372c, 0xce372c, 0xce372c, 0xce372c, 0xce372c, 0xce372c, 0xce372c, 0xce372c, 0x000000, 0x000000, 0x000000, 0xcd342c, 0xcb372b, 0xcb372b, 0xcb372b, 0xcb372b, 0xcb372b, 0xcb372b, 0xcb372b, 0xcb372b, 0xcb372b, 0xcb372b, 0xcb372b, 0xcb372b, 0x000000, 0x000000, 0x000000, 0x000000, 0xc83629, 0xc83629, 0xc83629, 0xc83629, 0xc83629, 0xc83629, 0xc83629, 0xc83629, 0xc83629, 0xc83629, 0xc83629, 0xc83629, 0x000000, 0x000000, 0x000000, 0x000000, 0xc3332a, 0xc3332a, 0xc3332a, 0xc3332a, 0xc3332a, 0xc3332a, 0xc3332a, 0xc3332a, 0xc3332a, 0xc3332a, 0xc3332a, 0xb32f22, 0x000000, 0x000000, 0x000000, 0x000000, 0xbc3227, 0xbc3227, 0xbc3227, 0xbc3227, 0xbc3227, 0xbc3227, 0xbc3227, 0xbc3227, 0xbc3227, 0xbc3227, 0xbc3227, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xb63025, 0xb63025, 0xb63025, 0xb63025, 0xb63025, 0xb63025, 0xb63025, 0xb63025, 0xb63025, 0xb52f24, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xb12e24, 0xb12e24, 0xb12e24, 0xb12e24, 0xb12e24, 0xb12e24, 0xb12e24, 0xb12e24, 0xb12e24, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xab2d21, 0xab2d21, 0xab2d21, 0xab2d21, 0xab2d21, 0xab2d21, 0xab2d21, 0x952c21, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x030006, 0xa42b20, 0xa42b20, 0xa42b20, 0xa42b20, 0xa42b20, 0xa42b20, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x992e1e, 0x9f291f, 0x9f291f, 0x9f291f, 0x9f291f, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x97271f, 0x99271d, 0x99271d, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x90221d, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, }; //end of array
void loop() {
PoiSonic(8000, array0,16,16);
}
void PoiSonic(unsigned long time, const unsigned int array[], int sliceNumber, int IMG){
unsigned long currentTime = millis();
while (millis()< currentTime + (time)) {
int f= sliceNumber;// previously used numberOfSlices;
int z; //a counter
int j=IMG;
for (int k=0; k<NUM_LEDS;k++){
for (int x=0;x<f;x++){
for(z=NUM_LEDS;z>0;z--){
leds[z-1]=array[x+((j-z)*f)];}
FastLED.show();
delayMicroseconds(40); //may need to increase / decrease depending on spin rate
}
delayMicroseconds(1000); //may need to increase / decrease depending on spin rate
}
}
}
#include "FastLED.h"
#define NUM_LEDS 32
#define DATA_PIN 17
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
}
const unsigned int array0[] = { 0x000000, 0x000000, 0x000000, 0x1d0f0d, 0xd83c30, 0x000201, 0x000000, 0x000000, 0x000000, 0x000000, 0xdb3f37, 0xdb3a2f, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xd4392d, 0xd3392d, 0xd3392d, 0xd3392d, 0x040204, 0x000000, 0x000000, 0xd3392d, 0xd3392d, 0xd3392d, 0xd3392d, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xd2382c, 0xd2382c, 0xd2382c, 0xd2382c, 0xd2382c, 0x000000, 0xd23a2c, 0xd2382c, 0xd2382c, 0xd2382c, 0xd2382c, 0xd1392c, 0x000000, 0x000000, 0x000000, 0xa94843, 0xd1372b, 0xd1372b, 0xd1372b, 0xd1372b, 0xd1372b, 0xc14036, 0xd1372b, 0xd1372b, 0xd1372b, 0xd1372b, 0xd1372b, 0xd1372b, 0x000000, 0x000000, 0x000000, 0xce3629, 0xce372c, 0xce372c, 0xce372c, 0xce372c, 0xce372c, 0xce372c, 0xce372c, 0xce372c, 0xce372c, 0xce372c, 0xce372c, 0xce372c, 0x000000, 0x000000, 0x000000, 0xcd342c, 0xcb372b, 0xcb372b, 0xcb372b, 0xcb372b, 0xcb372b, 0xcb372b, 0xcb372b, 0xcb372b, 0xcb372b, 0xcb372b, 0xcb372b, 0xcb372b, 0x000000, 0x000000, 0x000000, 0x000000, 0xc83629, 0xc83629, 0xc83629, 0xc83629, 0xc83629, 0xc83629, 0xc83629, 0xc83629, 0xc83629, 0xc83629, 0xc83629, 0xc83629, 0x000000, 0x000000, 0x000000, 0x000000, 0xc3332a, 0xc3332a, 0xc3332a, 0xc3332a, 0xc3332a, 0xc3332a, 0xc3332a, 0xc3332a, 0xc3332a, 0xc3332a, 0xc3332a, 0xb32f22, 0x000000, 0x000000, 0x000000, 0x000000, 0xbc3227, 0xbc3227, 0xbc3227, 0xbc3227, 0xbc3227, 0xbc3227, 0xbc3227, 0xbc3227, 0xbc3227, 0xbc3227, 0xbc3227, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xb63025, 0xb63025, 0xb63025, 0xb63025, 0xb63025, 0xb63025, 0xb63025, 0xb63025, 0xb63025, 0xb52f24, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xb12e24, 0xb12e24, 0xb12e24, 0xb12e24, 0xb12e24, 0xb12e24, 0xb12e24, 0xb12e24, 0xb12e24, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xab2d21, 0xab2d21, 0xab2d21, 0xab2d21, 0xab2d21, 0xab2d21, 0xab2d21, 0x952c21, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x030006, 0xa42b20, 0xa42b20, 0xa42b20, 0xa42b20, 0xa42b20, 0xa42b20, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x992e1e, 0x9f291f, 0x9f291f, 0x9f291f, 0x9f291f, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x97271f, 0x99271d, 0x99271d, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x90221d, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, }; //end of array
void loop() {
PoiSonic(8000, array0,16,16);
}
void PoiSonic(unsigned long time, const unsigned int array[], int sliceNumber, int IMG){
unsigned long currentTime = millis();
while (millis()< currentTime + (time)) {
int f= sliceNumber;// previously used numberOfSlices;
int z; //a counter
int j=IMG;
for (int k=0; k<NUM_LEDS;k++){
for (int x=0;x<f;x++){
for(z=NUM_LEDS;z>0;z--){
leds[z-1]=array[x+((j-z)*f)];}
FastLED.show();
delayMicroseconds(40); //may need to increase / decrease depending on spin rate
}
delayMicroseconds(1000); //may need to increase / decrease depending on spin rate
}
}
}