I read on another forum about a guy suggesting to use a light sensor module with digital output ( https://www.aliexpress.com/item/32571120284.html ) to make my LED strip turn on at night, and off during the day.
I have connected the module to D3, setup the macro T=2, and as such is working, however, the light sensor has to reach off/on (turn light off / turn light on) before it will turn off the light, and again off/on to turn it on again.
Is it not possible to make it work like I want to somehow?
the button pin is not really meant to interface to a sensor. Of course it is possible to get this to work, but I’d suggest a usermod to read the state of a pin to which the sensor is attached and then set the brightness accordingly using bri = x; or toggleOnOff().
Thanks, seems like it’s gonna be a bit above my head, as I have never written a piece of code
Would I be able to find a sketch perhaps, that is already reading the state from a sensor, and then just more or less copy it, and replace the functions with toggleOnOff() ?
Just replace your usermod.cpp file with this (completely untested though!)
I recommend using the VS Code development environment with platformio, it makes it a lot simpler to compile WLED on your own
When I boot it, it’s going dark after a couple of seconds, and staying there.
I tried changing pin 5 to 4, as I read that’s D2 for the 8266, but of course not sure at all, and it didn’t change anything.
Maybe a stupid question, but could be it be something with a pull-up resistor?
I keep reading about that
Ah sorry. I confused the pins . Pin 5 is D1, 4 is indeed D2. So please try 5, because 4 is used by the optional infrared function of WLED, that might interfere.
Depending on the sensor type, a pull-up resistor between pin 5 and 3.3v might indeed be required, you could give that a try
I was grounding and 3.3 volting the D2 on the esp board, and that worked fine when I switched between them.
But when I add my sensor, it will not go LOW. I actually have to ground the D2 before it it’s working. It’s not enough to remove the voltage from the D2, eventhough it’s only about 0.15 volt.
Shouldn’t a low volt be enough to make it go LOW, or do I actually need to ground D2 somehow?