Answer the question
In order to leave comments, you need to log in
Why doesn't it always connect to esp01 server?
there is a code for esp
#include <ESP8266WiFi.h>
#ifndef STASSID
#define STASSID "ssid"
#define STAPSK "pass"
#endif
const char* ssid = STASSID;
const char* password = STAPSK;
WiFiServer server(80);
void setup() {
Serial.begin(9600);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
server.begin();
}
void loop() {
WiFiClient client = server.available();
if (!client) {
return;
}
else
{
client.println(F("OK"));
}
client.setTimeout(5000);
byte* buf;
while (client)
while (client.available()) {
char c = client.read();
Serial.write(c);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question