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

User avatar
By ThomasRichter
#63080 Hi Guys,

i have a problem with my new ESP8266 E12.
I only have simple circuits on the outputs with a resistor + LED on each pin (see below).
Whenever i switch on a LED it works just fine, but sometimes when i shut off the pin, the LED is not totally turned of, but it's slightly glowing, so there might still be some small current flowing threw the LED, but i don't know why.
Here is my code (Arduino):

Code: Select all#define PIN 13

void setup()
{
    pinMode(PIN, OUTPUT);
}

void loop()
{
   // Turn on LED
   analogWrite(PIN, 1023);
   // Hold state for 10sec
   delay(10*1000);
   // Turn off LED
   analogWrite(PIN, 0);   // ! LED still glowing slightly
   // Hold state for 10sec
   delay(10*1000);
}
You do not have the required permissions to view the files attached to this post.
User avatar
By Barnabybear
#63125 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.
User avatar
By ThomasRichter
#63131
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! :)
User avatar
By rudy
#63133 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.