I try to make a communication between 2 Wemos D1. I have one who switch some Relais. I have configured him as a Accesspoint and Webserver with a smal html site. I can contact him with my mobile phone and can
switch the relais.
From the second Wemos D1 I have a problem. He can log in and get a IP Address. I have try any examples form different websites but nothing works. At present I use this to send the request:
void sendHttpRequest() {
const char* host = "192.168.4.1";
String url = "/rel1";
Serial.print("Requesting URL: ");
Serial.println(url);
// This will send the request to the server
client.print(String("GET ") + url + " HTTP/1.1\r\n" +
"Host: " + host + "\r\n" +
"Connection: close\r\n\r\n");
// start waiting for the response
unsigned long lasttime = millis();
while (!client.available() && millis() - lasttime < 1000) {delay(1);} // wait max 1s for data
// Read all the lines of the reply from server and print them to Serial
while(client.available()){
char readchar = client.read();
Serial.print(readchar);
}
This I have from a example who connect to a Internet website. This works.
Cane you help me with this problem?
Kindly Regards