0

Turn off NeoPixel temporarily (strip.stop())?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Turn off NeoPixel temporarily (strip.stop())?

by refnoredcard on Tue Dec 12, 2017 3:21 pm

Using a Huzza ESP8266 driving a 1m strip of 30 NeoPixels for an embedded holiday gift. I've set it up using the Adafruit_NeoPixel, esp8266/ArduinoOTA and tzapu/WiFiManager libraries so I can remotely reprogram patterns into the ESP8266 and everything is working great!

I would like have the neopixel strip act as status indicator during setup(); the Huzza is not exposed so using the builtin_led isn't viable. For example, turn on a few neopixels red when it is waiting for a new WiFiManager configuration. Problem is, when I do that, the ESP8266 is busy writing to the neopixel strip and not allowing WiFiManager to accept a new WiFi setup. Thus, I want to turn the neopixels on (via strip.show()), stop neopixel from writing (the color state will stay in the WS2812's), then later in setup() restart the strip. Something like strip.stop() ?

Code: Select all | TOGGLE FULL SIZE
setup() {
  strip.begin()
  // Turn on 3 dim red leds when waiting for WiFiMgr
  for (i = 0; i < 3; i++)  strip.setPixelColor(i, 32, 0, 0);
  strip.show();

  // strip.stop()               <--  Desired function to not interfere with WiFiManager

  WiFiManager wifiManager;
  wifiManager.setConfigPortalTimeout(180);
  /* ... rest of the WiFiManger

  // Turn leds back off
  for (i = 0; i < 3; i++)  strip.setPixelColor(i, 0);
  strip.show();

  /* ... ArduinoOTA and the rest of setup() */
}

Open to suggestions since strip.stop() doesn't exist!
Thanks, Mike

refnoredcard
 
Posts: 3
Joined: Mon Nov 18, 2013 2:00 am

Re: Turn off NeoPixel temporarily (strip.stop())?

by Disciple on Tue Dec 12, 2017 3:38 pm

I think you're okay without such a function. strip.show(); writes once to turn your pixels red and stops, then the smart pixels just hold their colors and the WiFi routines can run without hindrance until finished, and then the pixel blackout code can follow. At least, that's how the NeoPixel libraries work with all my boards. Hope this helps.

Hallelujah!
Disciple

Disciple
 
Posts: 498
Joined: Tue Jan 06, 2015 8:13 pm

Re: Turn off NeoPixel temporarily (strip.stop())?

by refnoredcard on Fri Dec 15, 2017 3:25 am

Thanks Disciple. I thought that was they way it worked, put a scope on the pin to verify. Turns out it was something going on funky with my wifi access point...reset it and haven't seen the problem since. Cheers & happy holidays!

refnoredcard
 
Posts: 3
Joined: Mon Nov 18, 2013 2:00 am

Please be positive and constructive with your questions and comments.