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

User avatar
By guillerone
#79434 Hi!
I just got an ESP8266 (dunno what specific version) and have been playing with it a little bit. I also got a ESP-01S relay board to plug it in, but I'm facing a weird problem.

I'm trying to make work the "ESP8266_Control_Relay" sample that can be found here: https://www.instructables.com/id/ESP010 ... -TUTORIAL/

I upload the code and it runs fine for the first time, I clic the ON or OFF buttons on the web server and they work.
However, that only works right after uploading the program to the board. If I disconnect and connect it again, it doesn't work.
Also, if I plug the board in without connecting the GPIO0 pin to the ESP-01S and connect it after it has booted, it works.

Same happens with the program I wrote from scrath, so the problem may not be with the program as it happes with 2 different ones. You can see the sample in the URL posted.

Basically, I think that if you connect the board with GPIO0 connected from the start, it doesn't work unless you just uploaded the code. If you connect it afterwards, it doesn't.
I tried putting the pinMode(0, OUTPUT); line in many different places, including in the loop for just the first itteration, but it doesn't make any difference.

Can anyone shed some light, please? I would really appreciate it.
Thank you in advanced.
User avatar
By QuickFix
#79450
guillerone wrote:Can anyone shed some light, please? I would really appreciate it.

Yes we can, but since this topic pops up every once in a while (and it's senseless repeating it every time), here's a hint that should get you going. :)

This is what our Wiki says:
ESP8266 Wiki wrote:ESP8266 has three modes of operation: SDIO mode, UART mode and FLASH mode. These are obtained by pulling three pins either high or low at bootup: GPIO15, GPIO0, GPIO2 according to this table:

0 Low
1 High
x floating
ESPModes.png

Notes :- GPIO2 It is considered safer to pull it high with a resistor on boot rather than leave it floating to avoid possible chip damage if pin is pulled high by your program but also see http://www.esp8266.com/viewtopic.php?f= ... 524#p22524. GPIO1 (UART TX) also has an effect on boot if pulled low; it will not boot in this case.

FLASH mode is when running the program. Take GPIO0 high or float or it will stall on first reset, intentional or not.
UART mode is how the code is uploaded to the chip and GPIO0 and GPIO15 must be low on boot to enter this mode.
SDIO mode is where the chip boots from an SD card. I don't think this is available to us yet.
You do not have the required permissions to view the files attached to this post.