adjusted blink animation from 1 byte per pixel to 1 bit per pixel
This commit is contained in:
parent
d5e20a932f
commit
f190e1a192
2 changed files with 56 additions and 49 deletions
|
@ -10,50 +10,7 @@
|
|||
#include <NeoPixelBrightnessBus.h>
|
||||
#include "defaults.h"
|
||||
|
||||
uint8_t test[][64] = { { 0, 0, 1, 1, 1, 1, 0, 0,
|
||||
0, 1, 0, 0, 0, 0, 1, 0,
|
||||
1, 0, 0, 0, 0, 0, 0, 1,
|
||||
1, 0, 0, 0, 1, 1, 0, 1,
|
||||
1, 0, 0, 0, 1, 1, 0, 1,
|
||||
1, 0, 0, 0, 0, 0, 0, 1,
|
||||
0, 1, 0, 0, 0, 0, 1, 0,
|
||||
0, 0, 1, 1, 1, 1, 0, 0 },
|
||||
|
||||
{ 0, 0, 1, 1, 1, 1, 0, 0,
|
||||
0, 1, 1, 1, 1, 1, 1, 0,
|
||||
1, 0, 0, 0, 0, 0, 0, 1,
|
||||
1, 0, 0, 0, 1, 1, 0, 1,
|
||||
1, 0, 0, 0, 1, 1, 0, 1,
|
||||
1, 0, 0, 0, 0, 0, 0, 1,
|
||||
0, 1, 1, 1, 1, 1, 1, 0,
|
||||
0, 0, 1, 1, 1, 1, 0, 0 },
|
||||
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 1, 1, 1, 1, 0, 0,
|
||||
0, 1, 1, 1, 1, 1, 1, 0,
|
||||
1, 0, 0, 0, 0, 0, 0, 1,
|
||||
1, 0, 0, 0, 0, 0, 0, 1,
|
||||
0, 1, 1, 1, 1, 1, 1, 0,
|
||||
0, 0, 1, 1, 1, 1, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 1, 1, 1, 1, 1, 1, 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
0, 1, 1, 1, 1, 1, 1, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0 } };
|
||||
|
||||
char test2[] = { 0x01, 0x23, 0x45, 0x67,
|
||||
0x89, 0xAB, 0xCD, 0xEF,
|
||||
|
@ -111,17 +68,21 @@ void loop() {
|
|||
|
||||
Serial.println("Animation test ...");
|
||||
for(int frame=0; frame<5; frame++) {
|
||||
for(int n=0; n<strip.PixelCount(); n++) {
|
||||
if(test[frame][n]) strip.SetPixelColor(n, RgbColor(255));
|
||||
else strip.SetPixelColor(n, RgbColor(0));
|
||||
for(int n=0; n<strip.PixelCount()/8; n++) {
|
||||
for(int i=0; i<8; i++) {
|
||||
if((eye_blink[frame][n])&(1<<i)) strip.SetPixelColor(n*8+i, RgbColor(255));
|
||||
else strip.SetPixelColor(n*8+i, RgbColor(0));
|
||||
}
|
||||
}
|
||||
strip.Show(); delay(20);
|
||||
}
|
||||
delay(100);
|
||||
for(int frame=3; frame>=0; frame--) {
|
||||
for(int n=0; n<strip.PixelCount(); n++) {
|
||||
if(test[frame][n]) strip.SetPixelColor(n, RgbColor(255));
|
||||
else strip.SetPixelColor(n, RgbColor(0));
|
||||
for(int n=0; n<strip.PixelCount()/8; n++) {
|
||||
for(int i=0; i<8; i++) {
|
||||
if((eye_blink[frame][n])&(1<<i)) strip.SetPixelColor(n*8+i, RgbColor(255));
|
||||
else strip.SetPixelColor(n*8+i, RgbColor(0));
|
||||
}
|
||||
}
|
||||
strip.Show(); delay(20);
|
||||
}
|
||||
|
|
|
@ -17,3 +17,49 @@ uint8_t colorMap[] = { 0x00, 0x00, 0x00,
|
|||
0xf5, 0xf4, 0xeb };
|
||||
|
||||
uint8_t brightness = 64;
|
||||
|
||||
uint8_t eye_blink[][8] = {
|
||||
{ B00111100,
|
||||
B01000010,
|
||||
B10000001,
|
||||
B10001101,
|
||||
B10001101,
|
||||
B10000001,
|
||||
B01000010,
|
||||
B00111100 },
|
||||
|
||||
{ B00111100,
|
||||
B01111110,
|
||||
B10000001,
|
||||
B10001101,
|
||||
B10001101,
|
||||
B10000001,
|
||||
B01111110,
|
||||
B00111100 },
|
||||
|
||||
{ B00000000,
|
||||
B00111100,
|
||||
B01111110,
|
||||
B10000001,
|
||||
B10000001,
|
||||
B01111110,
|
||||
B00111100,
|
||||
B00000000 },
|
||||
|
||||
{ B00000000,
|
||||
B00000000,
|
||||
B01111110,
|
||||
B11111111,
|
||||
B11111111,
|
||||
B01111110,
|
||||
B00000000,
|
||||
B00000000 },
|
||||
|
||||
{ B00000000,
|
||||
B00000000,
|
||||
B00000000,
|
||||
B11111111,
|
||||
B11111111,
|
||||
B00000000,
|
||||
B00000000,
|
||||
B00000000 } };
|
||||
|
|
Loading…
Reference in a new issue