i tried to use server.write() in one esp and client.read() in the other esp but it didn't work
how do i make this?
===============================================
server code:
===============================================
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
/* Set these to your desired credentials. */
const char *ssid = "islam";
const char *password = "123456789";
WiFiServer server(80);
void setup() {
pinMode(5, OUTPUT);
Serial.begin(115200);
delay(10);
Serial.println();
Serial.print("Configuring access point...");
/* You can remove the password parameter if you want the AP to be open. */
WiFi.softAP(ssid, password);
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
server.begin();
Serial.println("HTTP server started");
}
void loop() {
//server.handleClient();
server.write('s');
delay(200);
Serial.println("ss");
delay(200);
}
=========================================
client code:
=========================================
#include <ESP8266WiFi.h>
/* Set these to your desired credentials. */
const char *ssid = "islam";
const char *password = "123456789";
const char* host = "192.168.4.1";
WiFiClient client ;
void setup() {
Serial.begin(115200);
delay(10);
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() {
if (client.available()) {
char c = client.read();
Serial.println(c);
}
}