Hello, I have an Arduino Uno with ESP-01 ESP8266 connected to pins 5 and 6. I am using WiFiEsp.h library. I have installed XAMPP with Apache and MySQL. I want to send sensor data to a MySQL database. I can connect to wifi fine, but I can't connect to the Apache server running on my computer. The client.connect(server, 80) always fails. I have tried disabling firewall, but even with firewall turned off I can't connect. Do any of you have an idea what could be the issue?
Code:
#include <SoftwareSerial.h>
#include <WiFiEsp.h>
SoftwareSerial ESP(5, 6);
WiFiEspClient client;
char ssid[] = "bary";
char pass[] = "20158624";
char server[] = "10.0.0.33";
void setup(){
Serial.begin(9600);
ESP.begin(9600);
WiFi.init(&ESP);
while (WiFi.status() != WL_CONNECTED){
WiFi.begin(ssid, pass);
}
}
void loop(){
if (client.connect(server, 80)) {
Serial.println("Connected");
client.print("GET /php/sensor.php?value=");
client.print("test");
client.print(" HTTP/1.1");
client.println();
client.println("Host: 10.0.0.33");
client.println("Connection: close");
client.println();
}
else {
Serial.println("Failed");
}
}
Serial monitor output:
[WiFiEsp] Initializing ESP module
[WiFiEsp] Initilization successful - 1.5.4
[WiFiEsp] Connected to bary
[WiFiEsp] Connecting to 10.0.0.33
Failed
[WiFiEsp] Connecting to 10.0.0.33
When I use Serial.println(client.connect(server, 80)); it returns a 0.