Neopixel doesn't turn back on

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
laptopman
 
Posts: 16
Joined: Fri May 03, 2013 5:43 pm

Neopixel doesn't turn back on

Post by laptopman »

Using a neopixel stick, I have full functionality.

However, if I say strip.setBrightness(0); I am unable to get it to light back up. If my code says strip.setbrightness(1); everything works as expected. help?

User avatar
Franklin97355
 
Posts: 23939
Joined: Mon Apr 21, 2008 2:33 pm

Re: Neopixel doesn't turn back on

Post by Franklin97355 »

What have you tried to get it to light back up? Do you mean that after you set it to 0 setting it to 1 or any other number won't turn it back on?

User avatar
laptopman
 
Posts: 16
Joined: Fri May 03, 2013 5:43 pm

Re: Neopixel doesn't turn back on

Post by laptopman »

Correct

#include <Adafruit_NeoPixel.h>

#define PIXEL 4
#define DUTY 8
boolean lights = 0;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, PIXEL, NEO_GRB + NEO_KHZ800);

void setup(){
strip.begin();
strip.setBrightness(DUTY); // Set future
strip.show(); // Initialize all pixels to 'off'
strip.setPixelColor(0, 255, 0 ,0);
strip.show();
}

void loop(){
strip.setPixelColor(0, 255, 255, 0);
strip.setBrightness(8);
strip.show();
delay(1000);
strip.setBrightness(0);
strip.show();
delay(1000);
}

Results in the strip turning on, then off. It does not turn on again.
I had a version of this code with Serial feedback and the loop continued to run but the led's no longer came on

User avatar
adafruit_support_bill
 
Posts: 88144
Joined: Sat Feb 07, 2009 10:11 am

Re: Neopixel doesn't turn back on

Post by adafruit_support_bill »

However, if I say strip.setBrightness(0); I am unable to get it to light back up.
This is normal for setBrightness(). It is a 'lossy' operation and works better for dimming than for brightening.

setBrightness() operates directly on the neopixel data in memory and when you decrease the brightness, you lose the original data. Once the brightness goes to 0, all the pixel values in memory are zero and there is no way to restore them.

User avatar
laptopman
 
Posts: 16
Joined: Fri May 03, 2013 5:43 pm

Re: Neopixel doesn't turn back on

Post by laptopman »

Okay, so how to I blink a neopixel?

User avatar
adafruit_support_bill
 
Posts: 88144
Joined: Sat Feb 07, 2009 10:11 am

Re: Neopixel doesn't turn back on

Post by adafruit_support_bill »

Code: Select all

void loop()
{
strip.setPixelColor(0, 255, 255, 0);
strip.show();
delay(1000);
strip.setPixelColor(0, 0, 0, 0);
strip.show();
delay(1000);
}

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

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”