I want to use the Serial2 (U2UXD) to connect a LoRa module in order to TX and RX messages.
I checked the pinout of the ESP32 board and saw that Serial2 corresponds to 17 and 16 pins, in which i connected the LoRa RX and TX, accordingly.
While i am using the next code, nothing is sent to pin 17.
Instead, if i connect the LoRa RX and TX to pin 41 and 40 (which is the U0UXD ... TX0 and RX0 --> Serial), the same code works fine.
However, i need UoUXD to be free, for other use.
Code: Select all
#include <HardwareSerial.h>
#define RXD2 16 //RXX2 pin
#define TXD2 17 //TX2 pin
void setup() {
Serial.begin(115200);
Serial2.begin(115200, SERIAL_8N1, RXD2, TXD2);
}
void loop() {
Serial.println("Hello1");
Serial2.println(Hello2);
}
Could anybody help me?
Thank you a lot.