I make a project for my own, it consists to use ESP8266-ESP01 as wifi connection to send data to Apache server.
The problem is that I can't reach my server hosted on virtual machine(Linux Mint). I use AT command and it works great I can send data to my Windows server but I would like to do it with my Linux.
I did some test : I can ping ESP and Linux server from my Windows, I can ping ESP and Windows from Linux but Im only able to ping Windows from ESP with AT+PING command.
IPs are : 192.168.1.23 (Windows) 192.168.137.129 (Virtual Machine Linux) and 192.168.1.20 (ESP)
Here's my code :
void setup()
{
ESP8266.begin(9600);
delay(500);
ESP8266.println("AT+RST");
/* INIT */
delay(1000);
ESP8266.println("AT");
done = ESP8266.find("OK");
if(!done) {
delay(1000);
done = ESP8266.find("OK");
}
/* CLIENT MODE */
delay(1000);
ESP8266.println("AT+CWMODE=1");
done = ESP8266.find("OK");
if(!done) {
delay(1000);
done = ESP8266.find("OK");
}
/* */
delay(1000);
ESP8266.println("AT+CIPSTA=\"192.168.1.30\",\"192.168.1.1\",\"255.255.255.0\"");
//ESP8266.println("AT+CIPSTA=\"192.168.137.10\"");
done = ESP8266.find("OK");
while(!done) {
delay(1000);
done = ESP8266.find("OK");
}
/* FIND WIFI */
delay(1000);
ESP8266.println("AT+CWLAP");
done = ESP8266.find("OK");
while(!done) {
delay(1000);
done = ESP8266.find("OK");
delay(3000);
break;
}
/* CONNECTION WIFI SSID */
ESP8266.println("AT+CWJAP=\""+ssid+"\",\""+password+"\"");
done = ESP8266.find("OK");
while(!done) {
delay(1000);
done = ESP8266.find("OK");
}
/* MULTIPLE CONNECTION */
ESP8266.println("AT+CIPMUX=1");
done = ESP8266.find("OK");
if(!done) {
delay(1000);
done = ESP8266.find("OK");
}
/* DISPLAY IP */
ESP8266.println("AT+CIFSR");
done = ESP8266.find("STAIP");
if(!done) {
delay(1000);
done = ESP8266.find("OK");
}
/* PING SERVER */
delay(1000);
ESP8266.println("AT+PING=\"192.168.137.129\"");
done = false;
if(!done) {
delay(1000);
done = ESP8266.find("OK");
}
}
Here's the answer from ping return : "AT+PING="192.168.137.129" timeout ERROR"
Did I miss something ? I hope someone will find my mistake
Thank you