I am new to arduino and am trying to connect the esp8266 to arduino UNO and send commands to the arduino using an android phone. I have double, triple checked the connections and I am sure they are 100% correct. I have connected esp GND to arduino GND, esp VCC to arduino 5V, esp TX to arduino SoftwareSerial RX and esp RX to arduino SerialSoftware TX and CH_PD to 5V. I can connect to esp using my phone but I can't send commands to it. I am using TCP/UDP Terminal on android to test the connection. Phone is connected to the AP but in the app it is not. I configured the app with 192.168.4.1 IP and 333 Port and I know that app works correctly because I have tested its integrity several times before. I have searched so much and tried so many but non worked.
My code:
#include <SoftwareSerial.h>
SoftwareSerial ESP8266(2,3);
boolean FAIL_8266 = false;
#define BUFFER_SIZE 128
char buffer[BUFFER_SIZE];
void setup() {
Serial.begin(9600);
ESP8266.begin(115200); // change this value to your wifi module (esp8266) baud rate
do{
ESP8266.println("AT");
delay(1000);
if(ESP8266.find((char*)"OK"))
{
Serial.println("Module is ready");
delay(1000);
//configure ESP as AP
Serial.println("AT+CWMODE=2");
delay(1000);
//Set multi connections
Serial.println("AT+CIPMUX=1");
delay(1000);
Serial.println("Server setup finish");
delay(1000);
FAIL_8266 = false;
}
else{
Serial.println("Module have no response.");
delay(500);
FAIL_8266 = true;
}
}while(FAIL_8266);
ESP8266.setTimeout(100);
}
void loop() {
if(ESP8266.available()){
String msg = ESP8266.readString();
Serial.println("MSG: "+msg);
}
}
Could anyone please tell me what is wrong?