Completed Pixel::setColorMap()
This commit is contained in:
parent
218e1f6611
commit
0cf12f3331
|
|
@ -39,12 +39,12 @@
|
|||
|
||||
namespace ColorMap {
|
||||
|
||||
static const uint8_t RGB[4]={32,24,16,8};
|
||||
static const uint8_t RBG[4]={32,16,24,8};
|
||||
static const uint8_t BRG[4]={24,16,32,8};
|
||||
static const uint8_t BGR[4]={16,24,32,8};
|
||||
static const uint8_t GBR[4]={16,32,24,8};
|
||||
static const uint8_t GRB[4]={24,32,16,8};
|
||||
static const uint8_t RGB[4]={31,23,15,7};
|
||||
static const uint8_t RBG[4]={31,15,23,7};
|
||||
static const uint8_t BRG[4]={23,15,31,7};
|
||||
static const uint8_t BGR[4]={15,23,31,7};
|
||||
static const uint8_t GBR[4]={15,31,23,7};
|
||||
static const uint8_t GRB[4]={23,31,15,7};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -27,30 +27,68 @@
|
|||
|
||||
#include "Pixel.h"
|
||||
|
||||
#define PIXEL_PIN 26 // set this to whatever pin you are using - note pin cannot be "input only"
|
||||
#define PIXEL_PIN 32 // set this to whatever pin you are using - note pin cannot be "input only"
|
||||
#define NPIXELS 60 // set to number of pixels in strand
|
||||
#define COLORMAP ColorMap::GRB // sets the order in which color bytes are transmitted
|
||||
#define RGBW true // set to true if RGBW, else false if just RGB
|
||||
|
||||
Pixel testPixel(PIXEL_PIN);
|
||||
Pixel testPixel(PIXEL_PIN,RGBW);
|
||||
|
||||
void setup() {
|
||||
|
||||
Serial.begin(115200);
|
||||
delay(1000);
|
||||
|
||||
Serial.printf("Pixel Test on pin %d\n",PIXEL_PIN);
|
||||
Serial.printf("\n\nPixel Test on pin %d with %d pixels\n\n",PIXEL_PIN,NPIXELS);
|
||||
testPixel.setColorMap(COLORMAP);
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
void loop(){
|
||||
Serial.print("Red\n");
|
||||
testPixel.set(Pixel::RGB(100,0,0));
|
||||
|
||||
Serial.printf("Red...");
|
||||
for(int i=0;i<255;i++){
|
||||
testPixel.set(Pixel::RGB(i,0,0,0),NPIXELS);
|
||||
delay(10);
|
||||
}
|
||||
for(int i=255;i>=0;i--){
|
||||
testPixel.set(Pixel::RGB(i,0,0,0),NPIXELS);
|
||||
delay(10);
|
||||
}
|
||||
delay(2000);
|
||||
|
||||
Serial.print("Green\n");
|
||||
testPixel.set(Pixel::RGB(0,100,0));
|
||||
Serial.printf("Green...");
|
||||
for(int i=0;i<255;i++){
|
||||
testPixel.set(Pixel::RGB(0,i,0,0),NPIXELS);
|
||||
delay(10);
|
||||
}
|
||||
for(int i=255;i>=0;i--){
|
||||
testPixel.set(Pixel::RGB(0,i,0,0),NPIXELS);
|
||||
delay(10);
|
||||
}
|
||||
delay(2000);
|
||||
|
||||
Serial.print("Blue\n");
|
||||
testPixel.set(Pixel::RGB(0,0,100));
|
||||
Serial.printf("Blue...");
|
||||
for(int i=0;i<255;i++){
|
||||
testPixel.set(Pixel::RGB(0,0,i,0),NPIXELS);
|
||||
delay(10);
|
||||
}
|
||||
for(int i=255;i>=0;i--){
|
||||
testPixel.set(Pixel::RGB(0,0,i,0),NPIXELS);
|
||||
delay(10);
|
||||
}
|
||||
delay(2000);
|
||||
|
||||
Serial.printf("White...\n");
|
||||
for(int i=0;i<255;i++){
|
||||
testPixel.set(Pixel::RGB(0,0,0,i),NPIXELS);
|
||||
delay(10);
|
||||
}
|
||||
for(int i=255;i>=0;i--){
|
||||
testPixel.set(Pixel::RGB(0,0,0,i),NPIXELS);
|
||||
delay(10);
|
||||
}
|
||||
delay(2000);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue