So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Farhan
#79570 Hello,

I Managed to setup a master Mega(Serial Comm Sender) and Slave Mega(Receiver) both using ESP8266 module and able to send AT commands from Mega to ESP module. Master is setup as Station and Slave is setup as AP both are connected to 3.3 v power to the respective board.

Next thing I want to do is to send Serial Communication messages from Master Mega to Slave via Arduino using the ESP module connected to each.
Can you please advise how can this be accomplished.
Remember I have no code installed in esp module on either end I am open for suggestions

Connection is as follows
Master Mega
ESP|MEGA
RX | TX1
TX | RX1

SLAVE Mega
ESP|MEGA
RX | TX0
TX | RX0


Here is the Code for master Mega

void setup() {
// Open serial communications
Serial1.begin(115200);
Serial.begin(115200);
while(!Serial);
while(!Serial1);
}
void loop() { // run over and over
if (Serial1.available()) {
// reads input from serial console and writes to esp8266
Serial.write(Serial1.read());
}
if (Serial.available()) {
// reads input from esp8266 and writes to serial console
Serial1.write(Serial.read());
}
}
Code for Slave Mega
void setup() {
// Open serial communications
Serial1.begin(115200);
Serial.begin(115200);
while(!Serial);
while(!Serial1);
}
void loop() { // run over and over
if (Serial1.available()) {
// reads input from serial console and writes to esp8266
Serial.write(Serial1.read());
}
if (Serial.available()) {
// reads input from esp8266 and writes to serial console
Serial1.write(Serial.read());
}
}

}


Please advise if this is possible I am open for suggestions and if some code needs to be deployed to Esp module please advise whats needed and need instructions for how to upload code to esp using Arduino IDE with out additional hardware.

Here is the esp model that I have
https://www.digikey.ca/product-detail/e ... fUEALw_wcB


Thanks