Am I missing something regarding brightness? I feel like something else is going on, as when I upload the code, I do not get a R led, then G, then B as the setup shows, I get blue/green and then it seemingly is giving off incorrect colors. Did I short something out or confuse something somewhere?
Included is my code, and some shots of solder joints and configuration. edit: files were too big for forum, pics and vid here: https://imgur.com/a/Rrqwdk7
Below is my mildly modified strandtest: I have changed the rainbow color changing to set it to straight red for testing
Code: Select all
/*
Pixie reads data in at 115.2k serial, 8N1.
Byte order is R1, G1, B1, R2, G2, B2, ... where the first triplet is the
color of the LED that's closest to the controller. 1ms of silence triggers
latch. 2 seconds silence (or overheating) triggers LED off (for safety).
Do not look into Pixie with remaining eye!
*/
#include "Adafruit_Pixie.h"
#if (defined(__AVR__) || defined(ESP8266)) && !defined(__AVR_ATmega2560__)
// For UNO and others without hardware serial, we must use software serial...
// Set up the serial port to use softwareserial..
#include "SoftwareSerial.h"
#define PIXIEPIN 6 // Pin number for SoftwareSerial output
SoftwareSerial pixieSerial(-1, PIXIEPIN);
#else
// On Leonardo/M0/etc, others with hardware serial, use hardware serial!
// #0 is green wire, #1 is white
#define pixieSerial Serial1
#endif
#define NUMPIXELS 1 // Number of Pixies in the strip
Adafruit_Pixie strip = Adafruit_Pixie(NUMPIXELS, &pixieSerial);
// Alternately, can use a hardware serial port for output, e.g.:
// Adafruit_Pixie strip = Adafruit_Pixie(NUMPIXELS, &Serial1);
void setup() {
int i;
Serial.begin(9600);
Serial.println("Ready to Pixie!");
pixieSerial.begin(115200); // Pixie REQUIRES this baud rate
// Serial1.begin(115200); // <- Alt. if using hardware serial port
strip.setBrightness(2); // Adjust as necessary to avoid blinding
Serial.println("Red!");
for(i=0; i< NUMPIXELS; i++)
strip.setPixelColor(i, 255, 0, 0);
strip.show();
delay(1000);
Serial.println("Green!");
for(i=0; i< NUMPIXELS; i++)
strip.setPixelColor(i, 0, 255, 0);
strip.show();
delay(1000);
Serial.println("Blue!");
for(i=0; i< NUMPIXELS; i++)
strip.setPixelColor(i, 0, 0, 255);
strip.show();
delay(1000);
}
void loop() {
Serial.println("Rainbow!");
rainbowCycle(20);
}
// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
uint16_t i, j;
for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
for(i=0; i< NUMPIXELS; i++) {
strip.setPixelColor(i, 255,0,0);
//strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
}
strip.show();
delay(wait);
}
}
// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
if(WheelPos < 85) {
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
} else if(WheelPos < 170) {
WheelPos -= 85;
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
} else {
WheelPos -= 170;
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
}
And if it may prove useful, here is my existing code that I will be running when I get the pixie sorted out:
Code: Select all
// All potentiometer analog pins have value: 0 - 1023
#define PIN_CHAN1_R A0
#define PIN_CHAN1_G A1
#define PIN_CHAN1_B A2
#define PIN_CHAN1 A3
#define PIN_PIXIE_1 6
#define BRIGHTNESS 1
#define SLEEPTIME 100
#define NUMPIXELS 1
#include "Adafruit_Pixie.h"
#if (defined(__AVR__) || defined(ESP8266)) && !defined(__AVR_ATmega2560__)
// For UNO and others without hardware serial, we must use software serial...
// Set up the serial port to use softwareserial..
#include "SoftwareSerial.h"
SoftwareSerial pixieSerial(-1, PIN_PIXIE_1);
#else
// On Leonardo/M0/etc, others with hardware serial, use hardware serial!
// #0 is green wire, #1 is white
#define pixieSerial Serial
#endif
Adafruit_Pixie pixie1 = Adafruit_Pixie(1, &pixieSerial);
void setup()
{
int i;
Serial.begin(9600);
Serial.println("Ready to Pixie!");
pixieSerial.begin(115200); // Pixie REQUIRES this baud rate
// Serial1.begin(115200); // <- Alt. if using hardware serial port
pixie1.setBrightness(2); // Adjust as necessary to avoid blinding
Serial.println("Red!");
for(i=0; i< NUMPIXELS; i++)
pixie1.setPixelColor(i, 255, 0, 0);
pixie1.show();
delay(1000);
Serial.println("Green!");
for(i=0; i< NUMPIXELS; i++)
pixie1.setPixelColor(i, 0, 255, 0);
pixie1.show();
delay(1000);
Serial.println("Blue!");
for(i=0; i< NUMPIXELS; i++)
pixie1.setPixelColor(i, 0, 0, 255);
pixie1.show();
delay(1000);
}
void loop()
{
int chan1_brightness = map(analogRead(PIN_CHAN1), 0, 1023, 0, 255);
int chan1_brightness_percent = map(chan1_brightness, 0, 255, 0, 100);
// all analogRead values from the pots will be 0-1023, and the LEDs need 0-255, so we (ab)use map
int chan1_R = map(analogRead(PIN_CHAN1_R), 0, 1023, 0, 255);
int chan1_G = map(analogRead(PIN_CHAN1_G), 0, 1023, 0, 255);
int chan1_B = map(analogRead(PIN_CHAN1_B), 0, 1023, 0, 255);
pixie1.setBrightness(chan1_brightness);
pixie1.setPixelColor(0, chan1_R, chan1_G, chan1_B);
pixie1.show();
char buffer[100];
sprintf(buffer, "Ch1 (%d): 0x %X %X %X", chan1_brightness, chan1_R, chan1_G, chan1_B);
Serial.println(buffer);
delay(SLEEPTIME);
}
// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
uint16_t i, j;
for (j = 0; j < 256 * 5; j++) { // 5 cycles of all colors on wheel
for (i = 0; i < 1; i++) {
pixie1.setPixelColor(i, Wheel(((i * 256 / pixie1.numPixels()) + j) & 255));
}
pixie1.show();
delay(wait);
}
}
// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
if (WheelPos < 85) {
return pixie1.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
} else if (WheelPos < 170) {
WheelPos -= 85;
return pixie1.Color(255 - WheelPos * 3, 0, WheelPos * 3);
} else {
WheelPos -= 170;
return pixie1.Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
}