Flora Neopixels Dimming

Wearable electronics: boards, conductive materials, and projects from Adafruit!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Clickity
 
Posts: 14
Joined: Tue May 26, 2015 5:07 pm

Flora Neopixels Dimming

Post by Clickity »

Hello,

I am basically making a fancy flash light with neopixels. It'll do a startup pretty color sequence, then changes all the neopixels to white. I am using a 5vdc 2.1 Amp power source, a Flora, a 24 neopixel ring in sequence with a 12 neopixel ring. There is a switch between the power supply and the board. This is for work, I made one like a year ago and it works great, and now they want 4 more, but my notes on the project apparently aren't that great.

I am having an issue where the neopixels dim after a few moments, seemingly while the code is in void loop, however the single line of code run in the loop is the same that ends the void startup and this doesn't make sense to me. This happens in all 4 'flashlights.' See code below. It dims If it's connected to the computer or to the power supply, although it takes longer to dim if it's connected to the computer. When it is connected to the computer and dims I am no longer able to see it in the connected ports, like it's lost the data connection.

Any help on this issue would be much appreciated.


Code: Select all

#include <Adafruit_NeoPixel.h>
#include "Adafruit_FloraPixel.h"

//Flash light locking switch input:
#define PIN 8

Adafruit_NeoPixel strip = Adafruit_NeoPixel(40);//, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'

  rainbowCycle(2);
  
  //RED
  //colorWipe(strip.Color(255, 0, 75), 10); // Red
  //colorWipe(strip.Color(255, 0, 25), 12); // Red
  //colorWipe(strip.Color(255, 0, 0), 16); // Red 

 //BLUE
  colorWipe(strip.Color(0, 50, 255), 20); // Blueish
  colorWipe(strip.Color(0, 100, 150), 20); //Tealish
  colorWipe(strip.Color(0, 180, 180), 25); // Tealish 2

 //GREEN
 //colorWipe(strip.Color(0, 255, 75), 50); // Green
 //colorWipe(strip.Color(0, 255, 35), 50); // Green
 //colorWipe(strip.Color(0, 255, 0), 50); // Green

 //PURPLE
 //colorWipe(strip.Color(255, 75, 255), 50); // Purple
 //colorWipe(strip.Color(255, 35, 255), 50); // Purple
 //colorWipe(strip.Color(255, 0, 255), 50); // Purple

 delay(500);

  colorWipe(strip.Color(180, 180, 180), 50); // White

}

void loop() {

  
  colorWipe(strip.Color(180, 180, 180), 250); // White
  
}


// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, c);
      strip.show();
      delay(wait);
  }
}

// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256*3; j++) { // 3 cycles of all colors on wheel
    for(i=0; i< strip.numPixels(); i++) {
      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) {
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else if(WheelPos < 170) {
    WheelPos -= 85;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  } else {
   WheelPos -= 170;
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  }
}

Locked
Please be positive and constructive with your questions and comments.

Return to “Wearables”