[code]
#include "SoftwareSerial.h"
SoftwareSerial esp8266(5,6);
void setup() {
Serial.begin(38400, SERIAL_8N1);
esp8266.begin(38400);
esp8266.println("AT+RST\r\n");
delay(1000);
esp8266.println("AT+CIPCLOSE\r\n");
esp8266.println("AT+CIPMUX=0\r\n");
esp8266.println("AT+CWMODE=3\r\n");
String udpmode = "AT+CIPSTART=";
udpmode+="4,",
udpmode+= "UDP";
udpmode+=",";
udpmode+="196.168.4.1";
udpmode+=",10110,1001,0";
esp8266.println("udpmode\r\n");
esp8266.println("AT+CIPMODE=1\r\n");
}
void loop() {
// Send data;
String mydata = "123456";// Real data is variable. Needed because mydata contains periods and special characters
esp8266.println("AT+CIPSEND=6\r\n");
delay (2000);
esp8266.println("mydata\r\n");
delay(2000);
Serial.println(mydata);// So that I can see the data flowing on the serial monitor
}
// End of code