ESP does not connect to server when using mobile wifi modem
Posted: Wed Nov 09, 2016 12:15 am
Hello ... see a couple of days ago I was doing a small project which consists of sending data to mysql through the esp8266, the tests I have been doing with the house wifi and I was able to save data in mysql without problem ... but Now I wanted to do the same with a mobile wifi modem, the esp8266 can connect to the wifi network, but the problem is that you can not connect to the serividor
este es el codigo del esp8266 usando la libreria ESP8266Wifi
The ip of the server assigned by the house wifi was 10.0.0.10
anyone can help me with this problem please
este es el codigo del esp8266 usando la libreria ESP8266Wifi
Code: Select all
#include <ESP8266WiFi.h>
const char* ssid = "SSID";
const char* password = "PASSWORD";
const char* host = "192.168.1.101"; // ip of the server assigned by the mobile wifi modem
void setup() {
Serial.begin(9600);
// We start by connecting to a WiFi network
WiFi.begin(ssid, password);
}
void loop() {
delay(5000);
WiFiClient client;
const int httpPort = 80;
if (!client.connect(host, httpPort)) {
Serial.println("connection failed");
return;
}
else{
Serial.println("connected");
}
while(Serial.available()>0)
{
int dato =Serial.read();
client.print("GET /Proyecto/guardar.php?valor=");
client.print(dato);
client.println("HTTP/1.1");
}
}
The ip of the server assigned by the house wifi was 10.0.0.10
anyone can help me with this problem please