Go Down

Topic: Arduino +ESP8266 problem (Read 133 times) previous topic - next topic


Mar 23, 2019, 12:10 pm Last Edit: Mar 23, 2019, 12:20 pm by Vitor_Borba
Hi, I have a problem with sending AT command from Arduino Mega to ESP8266.  
Below my code:
Code: [Select]
#include <SoftwareSerial.h>

SoftwareSerial mySerial(19, 18); // RX, TX

void setup() {
  // Open serial communications and wait for port to open:
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only

  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port

void loop() { // run over and over
  if (mySerial.available()) {
  if (Serial.available()) {

Connection between Arduino and ESP ,

                            RX1 -  TX
                            TX1 - RX
                            3,3v - VCC,CH_EN
                            GND - GND
If I connect ESP to USB UART converter and I use serial port then i have communication and i can send AT command and ESP responds.
If you have any advice please reply.


Mar 23, 2019, 02:02 pm Last Edit: Mar 23, 2019, 02:03 pm by Juraj
why do you use SoftwareSerial on Mega with 4 Serials?
and you connect receive to receive and transmit to transmit pin?


So, should i use MultiSerialMega or somethig other?
I connect Rx from Arduino to Tx ESP and Tx Arduino to Rx ESP.


Mega has Serial, Serial1, Serial3, Serial3. on the board are labels for TX and RX 1 to 3. so wire the esp8266 to Serial3 and don't use SoftwareSerial.


Ok. Problem is solved. Thanks

Go Up