Hi!
Just started using App Inventor and tried to get connection between an app and an esp8266.
No problem sending a string from app to esp8266 and back again. But when I want the answer back from esp8266 to be one char, a pause, next char, a pause and so on I get stuck. In the IDE Serial Monitor it works but not in the app. All chars shows up at the same time when the loop is restarting.
Any suggestions how to solve it?
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <SoftwareSerial.h>
// #include <DFRobotDFPlayerMini.h>
// #include <EspSoftwareSerial.h>
#ifndef APSSID
#define APSSID "ESPap"
#define APPSK "thereisnospoon"
#endif
/* Set these to your desired credentials. */
const char* ssid = "abcde";
const char* password = "123456789";
WiFiServer server(80);
void setup() {
Serial.begin(115200);
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.on("/", handleRoot);
server.begin();
Serial.println("HTTP server started");
}
void loop() {
WiFiClient client = server.available();
if (!client) {
return;
}
Serial.println("New msg");
while(!client.available()){
delay(1);
}
String in = client.readStringUntil('/r');
Serial.println (in);
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();
Serial.println("H");
client.write("H");
delay(1000);
Serial.println("e");
client.print("e");
delay(1000);
Serial.println("l");
client.write("l");
delay(1000);
Serial.println("l");
client.write("l");
delay(1000);
Serial.println("o");
client.write("o");
delay(1000);
}