-->
Page 1 of 1

Blink GPIO2 on ESP-01

PostPosted: Tue Jul 14, 2015 7:28 am
by lajolo
Hi, I am experimenting with ESP-01 and Arduino IDE and I am trying to run the Blink GPIO2 example (code below).

The program seems to flash correctly, but then GPIO2 is stuck at 1 and never changes. Do you have any suggestions for debugging?
And do you know why Serial.print() instructions do not show up on the serial monitor?

Thanks!

void setup() {
pinMode(2, OUTPUT);
Serial.begin(9600);
Serial.println("setup");
}
void loop() {
digitalWrite(2, HIGH); // turn the LED on (HIGH is the voltage level)
Serial.println("HIGH");
delay(1000); // wait for a second
digitalWrite(2, LOW); // turn the LED off by making the voltage LOW Serial.println("LOW");
delay(1000); // wait for a second
}

Re: Blink GPIO2 on ESP-01

PostPosted: Wed Jul 15, 2015 5:22 pm
by sixbacon
Try a few of things.
The IDE normally works on 115200 for serial to the ESP8266
I am not sure but to use the Serial object you may need to start with
#include <ESP8266WiFi.h>
I have the same code without the references to the serial objectand it works fine
Lastly watch how you connect up the ESP8266 to the FTDI. If you are trying to run the ESP8266 and use the recomended circuit with DTR and RTS, using the Serial Monitor will play with these lines and put the ESP8266 in the wrong mode. See viewtopic.php?f=26&t=3990
Best of luck

Re: Blink GPIO2 on ESP-01

PostPosted: Thu Jul 16, 2015 1:58 am
by lajolo
Hello,
thanks for your reply.

The IDE normally works on 115200 for serial to the ESP8266


This has been my first issue with the ESP-01 module.
When I received it, it was set at 115200 and I could only see something with AT commands sent from Arduino with direct connections to Tx and Rx and Serial monitor speed set at 115200.

Later on, I re-flashed it with AT firmware v0.9.5.2 which sets it by default at 9600 and this allowed me to run with success some examples of AllAboutEE with AT commands sent from Arduino.
At the moment I am using Arduino IDE at 9600.
Should I change it back to 115200? And should I set the baud rate of ESP-01 at 115200?

I am not sure but to use the Serial object you may need to start with
#include <ESP8266WiFi.h>

I can try, but I think that it is needed only when the code uses the WiFi library (like the WiFiWebServer example).

Lastly watch how you connect up the ESP8266 to the FTDI. If you are trying to run the ESP8266 and use the recomended circuit with DTR and RTS, using the Serial Monitor will play with these lines and put the ESP8266 in the wrong mode.

I am not using DTR and RTS on my FTDI. I only connect Gnd-Gnd, Rx-Tx and Tx-Rx.

Re: Blink GPIO2 on ESP-01

PostPosted: Fri Jul 17, 2015 4:03 am
by lajolo
The Blink GPIO2 example now works on my ESP-01.

The problem was due to an insufficient power supply that was enough to allow the flashing of the device, but it could not sustain it at run time.

The Serial.print() instructions also work and sixbacon was right that I needed this line in the code:
#include <ESP8266WiFi.h>

Thanks!