B4R Question ESP8266 and Serial1

peacemaker

Expert
Licensed User
Longtime User
Hi, All

How most easy to use second UART of ESP8266, without touching the default Serial-to-USB of boards ?
It's needed for UART sensor boards.
I have found that there is some port swap possibility - just swap Serial to Serial1 after FW flashing from USB.
1620753277463.png



B4X:
Serial.begin(9600, SERIAL_8N1); //GPIO1 (TX) and GPIO3 (RX), 9600kbps, 8-bit data, no parity, 1-bit stop
//your brilliant code here
Serial.swap(); //GPIO15 (TX) and GPIO13 (RX)
Serial.flush(); //clear serial buffer

//your brilliant code here

Anyone tried ? Any B4R code example ?
 

peacemaker

Expert
Licensed User
Longtime User
OK, used SoftwareSerial lib with free GPIO13 and GPIO2 pins, avoiding GPIO1 and GPIO15 that used during flashing.
 
Upvote 0
Top