I'm trying to send a string from an ESP32 to an Arduino. I'm using a level shifter, where the Uno is now the Mega (since I couldn't get the Uno to work).
RX0 is now RX1, connected to UART2 of ESP32.
// Master sender ESP32
#include <HardwareSerial.h>
void setup() {
// Serial.begin(115200);
Serial2.begin(9600, SERIAL_8N1, 16, 17);
delay(100);
}
void loop() {
String shape = "1,2,3";
Serial2.println(shape);
delay(500);
}
//Receiver Mega
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial1.begin(9600);
Serial.begin(19200);
delay(100);
}
void loop() {
if (Serial1.available()) {
String received = "";
received = Serial1.readString();
Serial.println(received);
}
}
Is there something in either sketch that should be changed?