B4R Code Snippet ESP32 hardware serials on TTGO Lora board


Active Member
Licensed User
Following these instructions you have access to the 3 hardware serials on an ESP32.
Serial0 is connected to the USB interface.

The default pins are
Serial0 - RX: GPIO3 , TX: GPIO1
Serial1 - RX: GPIO9 , TX: GPIO10
Serial2 - RX: GPIO16 , TX: GPIO17

On a TTGO Lora board the GPIO 9,10,16,17 are not available,
but you can use almost any other pin with this code.

'RX=2, TX=4
#if C
void SerialNative1(B4R::Object* unused){
::Serial1.begin(115200, SERIAL_8N1, 2, 4);
b4r_main::_serialnative1->wrappedStream = &::Serial1;
#End If