Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Dimming Tony Dicola's Python Holiday Lights
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Dimming Tony Dicola's Python Holiday Lights

by davesutherland on Tue Jul 18, 2017 1:00 pm

Hi All,
I have this project working on an ESP8266 but would like to know if there is any way to dim the LED's ?
Hardcoding a maximum brightness setting perhaps?
They are very bright and consume quite a bit of current when 150 of these neopixels are lit !
Thanks Tony for this brilliant tutorial.
Regards
Dave

davesutherland
 
Posts: 5
Joined: Tue Jul 18, 2017 12:55 pm

Re: Dimming Tony Dicola's Python Holiday Lights

by adafruit_support_carter on Tue Jul 18, 2017 1:43 pm

Can you link to the specific guide you are following? Looks like Tony has several holiday themed light projects :). Want to make sure I'm following same one.

adafruit_support_carter
 
Posts: 17135
Joined: Tue Nov 29, 2016 2:45 pm

Re: Dimming Tony Dicola's Python Holiday Lights

by davesutherland on Tue Jul 18, 2017 2:43 pm

Hi,

Here is the link to the project ..

https://learn.adafruit.com/micropython- ... s/software

Thanks

davesutherland
 
Posts: 5
Joined: Tue Jul 18, 2017 12:55 pm

Re: Dimming Tony Dicola's Python Holiday Lights

by adafruit_support_carter on Tue Jul 18, 2017 4:45 pm

See if you can use the .set_brightness() command of the NeoPixel strip. Input range is from 0.0 to 1.0. Something like this:
Code: Select all | TOGGLE FULL SIZE
np.set_brightness(0.5)

and try putting it after this line:
Code: Select all | TOGGLE FULL SIZE
np = neopixel.NeoPixel(PIXEL_PIN, PIXEL_COUNT)

adafruit_support_carter
 
Posts: 17135
Joined: Tue Nov 29, 2016 2:45 pm

Re: Dimming Tony Dicola's Python Holiday Lights

by davesutherland on Wed Jul 19, 2017 11:17 am

Thanks,will try that :)

It seems this breaks something,neopixels do not respond at all,stay off after adding this line.

Also noticed when connecting using webrepl,a control c is not needed before files can be transferred to the device,it seems programme does not run on boot after making this change.
I am a complete noob to python,any other ideas pls ?

davesutherland
 
Posts: 5
Joined: Tue Jul 18, 2017 12:55 pm

Re: Dimming Tony Dicola's Python Holiday Lights

by tannewt on Wed Jul 19, 2017 11:52 pm

Hi Dave,
Do you see any error messages in the WebREPL? It sounds like there is some sort of error in your main code now.

What version of MicroPython or CircuitPython are you using? The neopixel libraries varies a bit and may not have the set_brightness() function.
Thanks,
Scott

tannewt
 
Posts: 1837
Joined: Thu Oct 06, 2016 8:48 pm

Re: Dimming Tony Dicola's Python Holiday Lights

by davesutherland on Thu Jul 20, 2017 11:14 am

Hi Scott,
No error in web repl,only the >>> prompt.
I am using micropython v 1.8.5 build of 2017/01/08 on ESP8266
thanks for the reply

davesutherland
 
Posts: 5
Joined: Tue Jul 18, 2017 12:55 pm

Re: Dimming Tony Dicola's Python Holiday Lights

by tannewt on Thu Jul 20, 2017 4:54 pm

Hi Dave,
It doesn't look like that (or any other) version of MicroPython has a set_brightness. Try removing that line and seeing if your code works again.

Another way to change the brightness is to edit the html file from the project. The colors are here: https://github.com/adafruit/ESP8266_Mic ... s.html#L69

Where you see 255 it means that color component is brightest. You'll want to scale all three components the same way to preserve the color.

Let me know how that goes.
Scott

tannewt
 
Posts: 1837
Joined: Thu Oct 06, 2016 8:48 pm

Re: Dimming Tony Dicola's Python Holiday Lights

by adafruit_support_carter on Thu Jul 20, 2017 5:23 pm

Hmmm. Was basing my suggestion off this:

https://github.com/adafruit/Adafruit_Ci ... xel.py#L36

So maybe it is CircuitPython only?

adafruit_support_carter
 
Posts: 17135
Joined: Tue Nov 29, 2016 2:45 pm

Re: Dimming Tony Dicola's Python Holiday Lights

by tannewt on Thu Jul 20, 2017 5:29 pm

Yup, CircuitPython only. MicroPython's version comes from here and is built in: https://github.com/micropython/micropyt ... eopixel.py

Thanks Carter!

tannewt
 
Posts: 1837
Joined: Thu Oct 06, 2016 8:48 pm

Re: Dimming Tony Dicola's Python Holiday Lights

by davesutherland on Fri Jul 21, 2017 1:13 pm

@ tannewt2

Editing the lights.html file did the trick !
Thanks to all for the suggestions.

davesutherland
 
Posts: 5
Joined: Tue Jul 18, 2017 12:55 pm

Re: Dimming Tony Dicola's Python Holiday Lights

by tannewt on Sat Jul 22, 2017 12:13 am

Perfect! Thanks for confirming Dave!

tannewt
 
Posts: 1837
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.