So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By ThomasRichter
#63169
rudy wrote:PWM = 0 most likely does not produce a constant 0 output. I expect you are seeing the minimum output which could be one pulse time. This quirk is typical with hardware PWM, but I thought that the PWM on the ESP8266 was done in software so I would thing that case could be handled.

Indeed. The PWM is made by software as far as i know. So that should not be a problem. But i have tried the approach above an that's working.
User avatar
By ThomasRichter
#63170
ThomasRichter wrote:
Barnabybear wrote:Hi, does this do the same if you use digitalWrite?
Code: Select allvoid loop()
{
   // Turn on LED
   digitalWrite(PIN, HIGH);
   // Hold state for 10sec
   delay(10*1000);
   // Turn off LED
   digitalWrite(PIN, LOW);   // ! LED still glowing slightly
   // Hold state for 10sec
   delay(10*1000);
}


The other thing to try is putting the LED between 3.3V and the GPIO, this will invert your code but it will not light if there are pull up resistors used on your board.


DigitalWrite had the same effect.
But i like your idea to connect the LED from 3V to digital pin. That might be an appropriate solution.
I'm gonna try it later.
Can i still remain pinMode as OUTPUT then?
Thanks anyway! :)


UPDATE: Your approach worked fine, thanks!