I see in the documentation for WLED that I can use a potentiometer as an Analog Button to control brightness.
However I can’t find much in the way of examples or documentation on the topic.
Specifically what I’d like to know is how to wire it up and which pin to connect it to.
I’d think I connect the ends of a potentiometer to 3.3v and ground with the center tap going to the analog pin of the esp. However I don’t know what pin number to fill into wled as the analog pin of a D1 mini is ADC0 at A0 but there is also a G0.
I think I’m having a similar confusion as Fuzzball.
I know how to wire a pot, but I’m not sure how to configure WLED to use the pot for brightness.
I see that in the “LED Preferences” I can set the pin number for the buttons and use the drop-down menu to set it to “Analog”, but what pin number do I set for ADC0 on the ESP8266 (it does not have a GPIO number, it’s just called ADC0)?
Presumably, once that is set, I can use a macro with “250” in the “double” column to set it to control the brightness, according to this wiki page, which seems slightly out of date.
There are usermods available that use external hardware to handle specific tasks. Perhaps there is a usermod that handles your needs perfectly, or close enough, or maybe just needs a little customization to work.
Thank you! I actually found this out while rummaging in the code after being pointed to usermods by huggy. I had tried configuring it before, but when I applied 3.3V or 0V to the A0 pin, I got the same result (depending on if it was set to analog or analog inverted). But now that I connected an actual potentiometer, it seems to work (although at one extreme the brightness is 0, then it gets brighter as the pot turns, until it reaches the other extreme, where it turns off the LEDs).
To be honest, while I’ve used WLED for a couple years, it’s always done what I’ve needed, so never dug into it and looked at the source code. It is amazing. I thought it would be huge headache to modify and not mess anything up, but it is also very user friendly!
I cannot turn off the strip via console or with api (& T = 2) because the analog button turns on again immediately. in the same way if I use an analog button to control the primary color (value 200) then I will no longer be able to change the color from the computer or app, because the analog button controls the color. Where am I wrong?
Nowhere! The analog pot overrules the app control. By default, the brightness potentiometer will turn the lights off if adjusted to either the minimum or maximum adjustment. You might be able to add in a SPST switch to disconnect the pot from ADC0 to restore app control, but I have not tested such a thing.
In theory, you should be able to control both brightness and pattern by using a rotary encoder and a screen, while still maintaining all features of the UI. I believe there are already usermods created to implement this.
I think I solved it by removing the resistance that prevented the analog button from turning off at 0v. Now it works fine. the analog value seems to “sleep” until the button is moved
Perfect job, congratulations.
the added resistance between the potentiometer and GND (as suggested on the wiki) cancels the shutdown also from the pc or second button even if the potentiometer is not touched. In practice, the resistance cancels the “sleep” of the potentiometer