Hi everyone, im trying to interface Arduino uno with the ESP8266 ESP-01 module using that circuit and the following code. After uploading the code i recieve on the serial monitor the "wifi started" message, but when i try to type the AT command i get "⸮⸮k⸮⸮⸮⸮⸮⸮". What could be wrong? Thank you.
<#include <SoftwareSerial.h>
SoftwareSerial wifi(2,3);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("Wifi started");
wifi.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available()>0){
byte b=Serial.read();
wifi.write(b);
}
if(wifi.available()>0){
byte b=wifi.read();
Serial.write(b);
}
}>
Forget Software Serial for testing. First try to connect directly to the ESP-01 with a hardware serial connection to verify the baud rate and the proper operation of the part. If it's set to a really high baud rate, it may be too fast for Software Serial. You can change the baud rate of the ESP-01, or you can use a hardware serial on the Arduino side.
Also don't forget the 5V to 3.3V level converters on the RX/TX lines between the ESP and the Arduino.
You are getting valid serial from the ESP, it is sending you the message, "ERROR". It has something to do with the characters that you are sending to it. However it can still be a connection problem because you can't see what the ESP is actually receiving.
I tried changing from Newline to No line ending and it kept reproducing whatever i was typing until i changed it to Both NL & CR and it gave OK, i dont really have any idea what i am doing, so could someone tell me that Both means ??
the AT firmware requires the command to be confirmed with two line end characters CR and LF. So you must set the Serial Monitor to send them. in code it is "\r\n" and println ends the string with \r\n