I am able to send AT commands when connecting to the software through the TX/RX pins (1, 0) and the ESP01 communicates perfectly. However, as soon as I start doing that same thing with code I can't get the ESP01 to respond whatsoever. All I'm trying to do is get an OK back from the serial monitor. I changed the baudrate on the ESP01 as well as my serial monitor from 115200 to 9600, 19200 using this command:
AT+UART_DEF=9600,8,1,0,0
Troubleshooting steps taken:
- Tried upping the voltage in case it wasn't getting enough current.
- Tried different ESP01s.
- Tried switching TX and RX pins.
- Tried using different pins on the Uno (2 and 3, 10 and 11, 7 and 8).
- tried changing
myESP.println("AT");
tomyESP.write("AT\n\r");
.
Nothing works. I've done a ton of research and I haven't found anything wrong with what I'm doing, do you guys have any ideas?
#define TX 3
#define RX 2
String ssid = "*****";
String password = "******";
#include "SoftwareSerial.h"
SoftwareSerial myESP(RX,TX);
void setup() {
pinMode(RX, INPUT);
pinMode(TX, OUTPUT);
myESP.begin(19200);
Serial.begin(19200);
}
void loop() {
myESP.println("AT");
delay(5000);
}
Schematic is as follows: TX -> pin 3 RX -> pin 2 Vcc -> 3.3v GND -> Ground CH_PD -> Vcc