I have programmed an ESP8266 using the circuit and program below. I tried to open the SerialMonitor once the program is uploaded to the ESP8266. I am getting an error when I am trying to open the SerialMonitor.
Error opening serial port 'COM5'. (Incorrect serial port)
What is the way to get the IP address assigned to the ESP8266?
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
//SSID and Password of your wifi router
const char* ssid = "Moto";
const char* password = "reset1234";
ESP8266WebServer server(80);
void setup() {
Serial.begin(9600);
WiFi.begin(ssid, password); //Connect to your WiFi router
Serial.println("");
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
//If connection successful show IP address in serial monitor
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP()); //IP address assigned to your ESP
server.begin(); //Start server
Serial.println("HTTP server started");
}
void loop() {
server.handleClient(); //Handle client requests
}
-
1you can't run the wifi off the 3.3v of most ftdi adapters; when it's idle in the "ready to flash" mode, it uses less power and works just fine. power the ESP from an external source and your serial port should work again.dandavis– dandavis2017年05月08日 19:19:38 +00:00Commented May 8, 2017 at 19:19
-
if you have GPIO permanently wired to GND, as your diagram implies, then your "sketch" will never be executed on the ESPJaromanda X– Jaromanda X2017年05月08日 23:35:14 +00:00Commented May 8, 2017 at 23:35
-
@dandavis do you mean that should I plug VCC and CH_PD of ESP8266 to other power source instead of FTDI ? I have 2XAA cell holder s3-ap-southeast-1.amazonaws.com/a2.datacaciques.com/wm/… and what voltage cell should I use here ?N Sharma– N Sharma2017年05月09日 04:34:19 +00:00Commented May 9, 2017 at 4:34
-
@JaromandaX Alright, I will remove it so should we only GND to GND other than no wire to GND in any circuit ?N Sharma– N Sharma2017年05月09日 04:35:35 +00:00Commented May 9, 2017 at 4:35
-
you are supposed to give the 01 3.3v. Two fresh AAs will probably be enough to get it working, but won't last the full battery charge. This is why ESP8266 devboards are popular. i keep a few of these around, but you can use an [email protected] and feed it the raw 5v to save cash...dandavis– dandavis2017年05月09日 04:38:44 +00:00Commented May 9, 2017 at 4:38
2 Answers 2
If you give your board a name with
WiFi.hostname("MyESP8266");
(for example) you can then look on your router in the section that lists DHCP assignments (on my Netgear it's Attached Devices). That should then show you the IP address of all the attached devices, including the ESP8266 which you will easily identify by its name.
Another option is to use mDNS. Look at some of the examples that come with the ESP8266 core and libraries to see how.
I used the app "Fing" on my phone. It shows you the devices that are connected to your WiFi. After entering all freacking IP adress aviable, found that the last one was the one of my esp8266 and a beautiful window saying "hello from esp8266!" appeared.
-
I like that app :-) Small thing is that it doesn't work when you put your esp in deep sleep like I did ;-)Amfasis– Amfasis2018年12月24日 14:41:50 +00:00Commented Dec 24, 2018 at 14:41