Post topics, source code that relate to the Arduino Platform

User avatar
By ingeea
#39344 Hello Community,
i am doing the first test, programming the ESP8266 module 12- which i have purchased from Adafruit - with arduino IDE and the same time i want to establish a communication between it and an application that runs on my pc.
Well i set the esp as tcp Server and the pc application as Client Server. When i want to send a char from the application pc to esp it runs and i am able to rpint it on the Serial Monitor of arduino. The Problem is when sending from the ESP (tcp Server) to the module. Well for the c# application i don t have any Knowledge about it i just upload examples codes and it runs perfectely. Is there anyone that have done such application or can you probably Redirect me to a Sketch that could help me. Anyway i copy below the Code i am using to send data from esp tp application pc, that's working perfectely.

#include <ESP8266WiFi.h>


const char* ssid = "";
const char* password = "";
String re,r2;
char thisChar ='d';

WiFiServer server(80); // creates a server that listens for incoming connections on the specified port.
void setup() {
Serial.begin(9600);
delay(10);
// We start by 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());

Serial.print("Wieder da...");
server.begin();
Serial.print("Verbunden mit dem WLAN");
IPAddress myAddress = WiFi.localIP();
Serial.println(myAddress);
}

void loop() {
WiFiClient kunde = server.available();
if (kunde == false){
// Serial.println("no client is connected");
}
else if (kunde.connected()){
Serial.println("Connected to client");
delay(10);
if (kunde.available()){
Serial.println("CLient send etwas");
delay(100);
re= kunde.read();
Serial.println("empfangen");
Serial.println(re);
delay(20);
r2= kunde.read();
Serial.println("wieder empfangen");
Serial.println(r2);
delay(1000);
}

Serial.println("disconnecting..");
delay(10);

kunde.stop();
}

}