I'm uploading this sketch to try connecting ESP to internet. However, most of the times I've ran it it takes a very long time to connect, a lot of times I've had to break the process because it seems it goes to nowhere. Few times it has connected in less than a minute. Is it any alternative to boost the connection?
Also, when I reset the module, it writes to the terminal 3 strange characters, and freezes without even starting to execute its sketch. Do you mind me asking how to solve that?
Regards!
#include <ESP8266WiFi.h>
const char red[] = "CDT10";
const char pass[] = "G7ZSY74Cs";
unsigned long muestra = 0;
void setup() {
Serial.begin(9600);
WiFi.mode(WIFI_STA);
WiFi.begin(red,pass);
while (WiFi.status() != WL_CONNECTED){
Serial.print(".");
delay(1000);
}
Serial.println("");
Serial.println("WiFi connected");
Serial.print("IP address: "); Serial.println(WiFi.localIP());
Serial.print("Chip ID: "); Serial.println(ESP.getChipId());
}
void loop() {
delay(5000);
muestra = millis();
Serial.println(muestra);
}
-
Which board are you using?Majenko– Majenko2017年05月09日 18:13:10 +00:00Commented May 9, 2017 at 18:13
-
Right now, ESP-01.Julio– Julio2017年05月09日 18:14:23 +00:00Commented May 9, 2017 at 18:14
-
is the bandwidth ok once it connects?dandavis– dandavis2017年05月09日 18:27:04 +00:00Commented May 9, 2017 at 18:27
1 Answer 1
I have also experienced the inability to connect sometimes. I wait a certain amount of time for it to connect then do a ESP.reset() if it fails.
As for the boot problem it sounds like you are keeping GPIO0 low so it goes back into programming mode. Hold it high and it will run your program instead.
-
It worked! I forgot to hold high the GPIO0. Now it is running right. Thanks!Julio– Julio2017年05月09日 19:37:17 +00:00Commented May 9, 2017 at 19:37