Hi,
My objective is to run 2 serial ports concurrently on the BW16. For this purpose I have used a TTL to UART adapter for uploading sketch. Simultaneously I want to use the onboard CH341 based USB port for my second serial port.
For the above, I am using the following slightly modified SoftSerial example for BW16. I am using PUTTY for serial monitor while the Arduino Serial Monitor is being used for sketch upload.
#include <SoftwareSerial.h>
#if defined(BOARD_RTL8722DM)
SoftwareSerial mySerial(0, 1); // RX, TX
#elif defined(BOARD_RTL8722DM_MINI)
SoftwareSerial mySerial(2, 1); // RX, TX
#elif defined(BOARD_RTL8720DN_BW16)
SoftwareSerial mySerial(PB2, PB1); // RX, TX
#elif defined(BOARD_RTL8721DM)
SoftwareSerial mySerial(3, 4); // RX, TX
#elif defined(BOARD_RTL8720DF)
SoftwareSerial mySerial(17, 16); // RX, TX
#else
SoftwareSerial mySerial(0, 1); // RX, TX
#endif
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(4800);
mySerial.println("Hello, world?");
}
void loop() { // run over and over
mySerial.write("Hello, world?");
delay(1000);
Serial.println("Goodnight moon!");
delay(2000);
}
The sketch output works upto the point <Serial.println(“Goodnight moon!”);> in setup().
However I do not receive any output from <mySerial.println(“Hello, world?”);> ( also in setup() )on the CH341 USB port line on PUTTY.
The environment is Windows 10 on a laptop.
Please help.
Thanks and Regards