Neopixel strip in a non-regular grid
Re: Neopixel strip in a non-regular grid
Re: Neopixel strip in a non-regular grid
Re: Neopixel strip in a non-regular grid
const int16_t TubaGrid[] = {
-1,-1,-1,-1,-1,218,219,220,221,222,223,-1,-1,-1,-1,-1,
-1,-1,-1,217,216,215,214,213,212,211,210,209,208,-1,-1,-1,
-1,-1,196,197,198,199,200,201,202,203,204,205,206,207,-1,-1,
-1,195,194,193,192,191,190,189,188,187,186,185,184,183,182,-1,
-1,168,169,170,171,172,173,174,175,176,177,178,179,180,181,-1,
167,166,165,164,163,162,161,160,159,158,157,156,155,154,153,152,
136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,
135,134,133,132,131,130,129,128,127,126,125,124,123,122,121,120,
104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,
103,102,101,100,99,98,97,96,95,94,93,92,91,90,89,88,
72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,
71,70,69,68,67,66,65,64,63,62,61,60,59,58,57,56,
-1,42,43,44,45,46,47,48,49,50,51,52,53,54,55,-1,
-1,41,40,39,38,37,36,35,34,33,32,31,30,29,28,-1,
-1,-1,16,17,18,19,20,21,22,23,24,25,26,27,-1,-1,
-1,-1,-1,15,14,13,12,11,10,9,8,7,6,-1,-1,-1,
-1,-1,-1,-1,-1,0,1,2,3,4,5,-1,-1,-1,-1,-1
};
uint16_t circleGrid(uint16_t x, uint16_t y) {
y = y * 16 + x; // Compute index number based on 16x17 matrix
return TubaGrid[y];
}
Re: Neopixel strip in a non-regular grid
Re: Neopixel strip in a non-regular grid
Re: Neopixel strip in a non-regular grid
Re: Neopixel strip in a non-regular grid
#include <Adafruit_NeoPixel.h>
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Fonts/FreeSansBold9pt7b.h>
#define PIN 6
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(16, 17, PIN,0, NEO_GRB + NEO_KHZ800);
const uint32_t colors[] = { matrix.Color(255, 0, 0), matrix.Color(0, 255, 0), matrix.Color(0, 0, 255), matrix.Color(255, 255, 255) };
const uint32_t iRed = matrix.Color(255, 0, 0);
const uint32_t iGreen = matrix.Color(0, 255, 0);
const uint32_t iBlue = matrix.Color(0, 0, 255);
const uint32_t iWhite = matrix.Color(255, 255, 255);
const uint32_t iGold = matrix.Color(255, 215, 0);
const uint32_t iOrange = matrix.Color(255, 165, 0);
const uint32_t iOff = matrix.Color(0, 0, 0);
const uint16_t iHeart4[] = {35,47,48,49,66,65,64,63,62,76,77,78,79,80,81,82,99,98,97
,96,95,94,93,107,108,109,110,111,112,113,114,115
,132,131,130,129,128,127,126,125,124,139,140,141,142
,143,144,145,146,147,164,163,162,161,160,159,158
,157,156,171,172,173,175,176,177};
const uint16_t iHeart5[] = {21,36,35,34,46,47,48,49,50,67,66,65,64,63,62,61
,75,76,77,78,79,80,81,82,83,101,100,99,98,97,96,95,94,93,92,91,106,107,108,109
,110,111,112,113,114,115,116,133,132,131,130,129,128,127,126,125,124,123,138,139
,140,141,142,143,144,145,146,147,148,165,164,163,162,161,160,159,158,157,156
,155,170,171,172,173,174,175,176,177,178,192,191,190,188,187,186};
const uint16_t iHeart6[] = {11,20,21,22,37,36,35,34,33,45,46,47,48,49,50,51,68,67,66
,65,64,63,62,61,60,74,75,76,77,78,79,80,81,82,83,84,101,100,99,98,97,96,95,94,93,92
,91,105,106,107,108,109,110,111,112,113,114,115,116,117,134,133,132,131,130,129,128
,127,126,125,124,123,122,137,138,139,140,141,142,143,144,145,146,147,148,149,166,165
,164,163,162,161,160,159,158,157,156,155,154,168,169,170,171,172,173,174,175,176,177
,178,179,180,194,193,192,191,190,188,187,186,185,184,197,198,199,203,204,205};
const int16_t TubaGrid[] = {
-1,-1,-1,-1,-1,218,219,220,221,222,223,-1,-1,-1,-1,-1,
-1,-1,-1,217,216,215,214,213,212,211,210,209,208,-1,-1,-1,
-1,-1,196,197,198,199,200,201,202,203,204,205,206,207,-1,-1,
-1,195,194,193,192,191,190,189,188,187,186,185,184,183,182,-1,
-1,168,169,170,171,172,173,174,175,176,177,178,179,180,181,-1,
167,166,165,164,163,162,161,160,159,158,157,156,155,154,153,152,
136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,
135,134,133,132,131,130,129,128,127,126,125,124,123,122,121,120,
104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,
103,102,101,100,99,98,97,96,95,94,93,92,91,90,89,88,
72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,
71,70,69,68,67,66,65,64,63,62,61,60,59,58,57,56,
-1,42,43,44,45,46,47,48,49,50,51,52,53,54,55,-1,
-1,41,40,39,38,37,36,35,34,33,32,31,30,29,28,-1,
-1,-1,16,17,18,19,20,21,22,23,24,25,26,27,-1,-1,
-1,-1,-1,15,14,13,12,11,10,9,8,7,6,-1,-1,-1,
-1,-1,-1,-1,-1,0,1,2,3,4,5,-1,-1,-1,-1,-1
};
void setup() {
matrix.setFont(&FreeSansBold9pt7b);
matrix.begin();
matrix.setTextWrap(false);
matrix.setBrightness(255);
matrix.setTextColor(colors[0]);
matrix.setRemapFunction(circleGrid);
}
void loop() {
for(int pass = 0; pass<4; pass++)
{
DoLetter(colors[pass],750, "I",5);
delay(250);
DoHeart(colors[pass],750);
delay(250);
DoLetter(colors[pass],375, "U",2);
delay(125);
DoLetter(colors[pass],375, "S",2);
delay(125);
DoLetter(colors[pass],375, "A",2);
delay(125);
delay(500);
}
}
void DoHeart(uint16_t iColor, int iDelay)
{
matrix.fillScreen(0);
matrix.show();
for(int i=0;i<65;i++)
{
matrix.setPixelColor(iHeart4[i],iColor);
}
matrix.show();
delay(iDelay);
matrix.fillScreen(0);
matrix.show();
return;
}
void DoLetter(uint16_t iColor, int iDelay, String sLetter, int iCursor)
{
matrix.setFont(&FreeSansBold9pt7b);
matrix.fillScreen(0);
matrix.setCursor(iCursor, 14);
matrix.setTextColor(iColor);
matrix.print(sLetter);
matrix.show();
delay(iDelay);
matrix.fillScreen(0);
matrix.show();
return;
}
void DoText(uint16_t iColor, int iDelay)
{
matrix.setFont(&FreeSansBold9pt7b);
for(int x=0;x > -90;x--)
{
matrix.fillScreen(0);
matrix.setCursor(x, 14);
matrix.print(F(" Fairfax!"));
matrix.setTextColor(iColor);
matrix.show();
delay(iDelay);
}
matrix.fillScreen(0);
matrix.show();
return;
}
void DoCircles(uint16_t iColor, int iRepeat, int iDelay1, int iDelay2)
{
matrix.fillScreen(0);
for(int j=0;j<iRepeat;j++)
{
for(int i=1;i<12;i++)
{
matrix.fillScreen(0);
matrix.drawCircle(8,8,i,iColor);
matrix.drawCircle(8,8,i-1,iColor);
matrix.show();
delay(iDelay1);
}
//delay(iDelay2);
for(int i=9;i>=0;i--)
{
matrix.fillScreen(0);
matrix.drawCircle(8,8,i,iColor);
matrix.drawCircle(8,8,i+1,iColor);
matrix.show();
delay(iDelay1);
}
matrix.fillScreen(0);
matrix.show();
delay(iDelay2);
}
return;
}
// Brute force address conversion, XY to live pixels
uint16_t circleGrid(uint16_t x, uint16_t y) {
y = y * 16 + x; // Compute index number based on 16x17 matrix
return TubaGrid[y];
}
Re: Neopixel strip in a non-regular grid
Re: Neopixel strip in a non-regular grid
Re: Neopixel strip in a non-regular grid
Re: Neopixel strip in a non-regular grid
Re: Neopixel strip in a non-regular grid