I would like to know if it is possible to serialize data from the esp32 module to the arduino mega,
Currently I can send data from the arduino to the esp32 by serial, but I don't know how to send it now from the esp32 to the arduino
Welcome to the forum
Your topic was MOVED to its current forum category which is more appropriate than the original as it has nothing to do with Installation and Troubleshooting of the IDE
you can send serial data between the ESP32 and Mega in both directions
the Mega uses 5V logic and the ESP32 3.3V logic therefore you require a potential divider on the Mega TX to ESP32 Rx, e.g.
any particular reason why you require two microcontrollers? could you just use the ESP32?
I am communicating from the arduino to the esp32 by serial using arduino (rx0 and tx1) to the esp32 (17,16) and it worked without problems but I wanted to carry out the same operation but now from the esp32 to the arduino due to the issue of editing variables when using some sensors,
I appreciate your support
I connected the ESP32 to the Mega Serial1 hardware port as shown in post 3
a program I used the test the ESP32 serial communication was (you can select the pins as shown)
// ESP32 Serial1 test
// for loopback test connect pins 14 and 15
#define RXD1 14
#define TXD1 15
void setup() {
// initialize both serial ports:
Serial.begin(115200);
Serial1.begin(115200, SERIAL_8N1, RXD1, TXD1);
Serial.println();
Serial.println("serial1 test Rx pin 14 Tx pin 15");
}
void loop() {
// read from port 1, send to port 0:
if (Serial1.available()) {
int inByte = Serial1.read();
Serial.write(inByte);
}
// read from port 0, send to port 1:
if (Serial.available()) {
int inByte = Serial.read();
//Serial.write(inByte);
Serial1.write(inByte);
}
}
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.