JurajA wrote:it is a standard communication over a TCP/IP network
I used this code but it didn't work. Is there something wrong with this code? If I want to pass the string to a modulator-demodulator, how do I do that?
#include <ESP8266WiFi.h>
const char* ssid = "xxx"; //SSID Access Point
const char* password = "123"; //Password Access Point
const char* host = "http://192.168.100.1";
//Client-ESP8266 IP Address
IPAddress IP(192,168,100,200);
IPAddress NETMASK(255,255,255,0);
IPAddress NETWORK(192,168,100,1);
IPAddress DNS(192,168,100,1);
void setup() {
Serial.begin(1200);
delay(100);
// Connecting to a WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {
WiFiClient client;
Serial.printf("\n[Connecting to %s ...", host);
if (client.connect(host, 80))
{
Serial.println("connected]");
Serial.println("[Sending a request]");
client.print(String("GET /") + " HTTP/1.1\r\n" +
"Host: " + host + "\r\n" +
"Connection: close\r\n" +
"\r\n"
);
Serial.println("[Response:]");
while (client.connected() || client.available())
{
if (client.available()){
String line = client.readStringUntil('\n');
Serial.println(line);
}
}
client.stop();
Serial.println("\n[Disconnected]");
}
else
{
Serial.println("connection failed!]");
client.stop();
}
delay(5000);
}
https://arduino.stackexchange.com/quest ... 6899#66899