If I don't declare Serial.begin(115200)
, I can send AT
commands over serial monitor and it replies me.
But when I declare Serial.begin(115200)
and send AT
commands inside program or serial monitor there is nothing happens.
Did I miss something?
-
1Just copy-paste the code/output. Don't post screenshots.gre_gor– gre_gor2017年02月09日 13:59:33 +00:00Commented Feb 9, 2017 at 13:59
-
But I'm not answer to someone. You don't need the codes.ozgrozer– ozgrozer2017年02月09日 15:13:01 +00:00Commented Feb 9, 2017 at 15:13
2 Answers 2
You have connected the tx of the Arduino to the tx of the ESP8266 and the rx of the Arduino to the rx of the ESP8266.
What is happening when you type AT in the Serial Monitor is that you are communicating directly with the ESP8266, and not with the Arduino.
You need to connect the rx of the Arduino to the tx of the ESP8266 and the tx of the Arduino to the rx of the ESP8266.
This has asked and answered a number of times, such as:
Arduino Uno and ESP8266 serial monitor issue
Arduino Nano v3.0 with ESP8266
ESP 8266 does not respond at all
Your ESP8266 definitely uses a baud rate of 115200 (as confirmed by your first screen shot), so you don't need to change that when experimenting.
Thank you for the answer @Holmez, third link was very helpful. I was just change the code and the RX, TX pins like below and it works perfect now. I can send commands to the ESP both in program and over the serial monitor.
#include <SoftwareSerial.h>
SoftwareSerial wifi(10, 11);
void setup() {
Serial.begin(115200);
wifi.begin(115200);
Serial.println("Test");
wifi.println("AT+CIFSR");
}
void loop() {
if (Serial.available()) {
wifi.write(Serial.read());
}
if (wifi.available()) {
Serial.write(wifi.read());
}
}