-->
Page 1 of 2

Error when trying to run a simple code.

PostPosted: Mon Sep 03, 2018 3:06 am
by chamathkv
Hi, I am completely new to ESP8266. I recently purchased a ESP 12E module along with a FTDI board and followed the instructions from the link below.

https://www.instructables.com/id/ESP-12F-ESP8266-Module-Minimal-Breadboard-for-Flas/

I managed to upload the code using the schematic shown in that link. Click upload, hold flash button, once upload begins, tap reset and let go of the flash button, this gave me the following output.

Image

But I don't see the desired result. I am expecting to blink an LED via GPIO4 which should happen from the code I am using.

Code: Select all/* example from  http://www.arduinesp.com/examples  */
/* to be flashed directly to ESP8266 */
int ledPin = 4;
void setup()
{
pinMode(ledPin, OUTPUT);
}
void loop()
{
digitalWrite(ledPin, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}


The preferences chosen are as shown below.
Image

Re: Error when trying to run a simple code.

PostPosted: Fri Dec 21, 2018 2:02 pm
by JoeVanGeaux
I had a similar, or the very same, problem just recently.

Change the "4" in your sketch to a "D7" then attach an LED (the longer leg) to the D7 output and the shorter leg (the ground) to "G". Then reload your sketch. A lot of these sketches are referencing pin connections that don't mesh exactly with every (or many?) varieties of other boards out there, so some translation is in order - and I'm still trying to figure that out, myself!

I suspect this isn't the most elegant (read: "proper") way to hook up the LED, but it worked for me. A resistor of some value may need to be added in series with the led (you may find that is some tutorial videos) because when the code is loading the LED is dimly lit and I think, just maybe?, it shouldn't really be lit at all at that point.

Good luck!

Re: Error when trying to run a simple code.

PostPosted: Fri Dec 21, 2018 2:56 pm
by McChubby007
JoeVanGeaux wrote:I had a similar, or the very same, problem just recently.

Change the "4" in your sketch to a "D7" then attach an LED (the longer leg) to the D7 output and the shorter leg (the ground) to "G". Then reload your sketch. A lot of these sketches are referencing pin connections that don't mesh exactly with every (or many?) varieties of other boards out there, so some translation is in order - and I'm still trying to figure that out, myself!

I suspect this isn't the most elegant (read: "proper") way to hook up the LED, but it worked for me. A resistor of some value may need to be added in series with the led (you may find that is some tutorial videos) because when the code is loading the LED is dimly lit and I think, just maybe?, it shouldn't really be lit at all at that point.

Good luck!


You must use a series resistor to ensure current is limited, otherwise the LED may be destroyed. There are many internet instructions on how to calculate the resistance you need according to the led you use.

If the led is destroyed then it will remain unlit and any other problems you might have will be impossible to determine (such as wrong output pin).

Re: Error when trying to run a simple code.

PostPosted: Fri Dec 21, 2018 3:21 pm
by JoeVanGeaux
@McChubby007: Thanks!!! that makes perfect sense. I saw a video on UTube that showed how to flash an LED like that and it worked perfectly for me.... for a while. But now your explanation (as I suspected) explains why it was a "short term" demo - I should have suspected that but was too anxious to get some measure of success with these cool little boards.

The LED did, sure enough blink, while I ran the sketch several times, but then when I went further into learning how to fail at getting any real workable stepper control sketches in place, I re-checked to see if I hadn't bricked my NodeMCU in the process. Longer story shorter, I did fry that LED with that demo!! (I now use the LED and its leads as a "hold down" for other non electronic parts on my breadboard! )