Hi there,
So I added the code to the Xiao that was powering the Radar for the previous post.
In order to connect up the PC app and get it going. SoftSerial is needed for the pins 2, 3 in the sketch those are connected to the radar and did the trick,(the Radar uses the pins 3 & 2 Respectively) that and setting all the speeds (baud rate) the same, including the Radar.
You use the Bluetooth app to change the baud rate by Clicking the more button , change it from default 256000 to
115200, confirm the change and go back to PC app and Click
Connect , then
Start. and “Bob’s your Uncle” it works,
Notes:
You can’t have a serial monitor open on the port from the IDE or the PC app won’t connect.
you can leave the IDE open but no serial monitor OPEN, in the video I close it b4 hitting the connect and Start.
When you press reset on the Xiao, you will see the POWER ON message on the serial monitor, along with the radar , wrong baud rate data…Close the monitor and proceed.
Pretty trick Hardware SEEED I’ll be using a few of them.
here’s the code for the Xiao ESP32C3
/*
Multiple Serial ports relay test (works and tested on Xiao ESP32C3)
Receives from the main serial port, sends to the others.
Receives from serial port 1, sends to the main serial (Serial 0).
*/
#include <SoftwareSerial.h>
#define MYPORT_TX A3
#define MYPORT_RX A2
EspSoftwareSerial::UART myPort;
void setup() {
Serial.begin(115200); // Standard hardware serial port
while (!Serial);
delay(2000);//relax...Get Ready for serial port
Serial.println();
Serial.println("Power ON \n "); // Let's BEGIN!!
Serial1.print("\r");
myPort.begin(115200, SWSERIAL_8N1, MYPORT_RX, MYPORT_TX, false);
if (!myPort) { // If the object did not initialize, then its configuration is invalid
Serial.println("Invalid EspSoftwareSerial pin configuration, check config");
while (1) { // Don't continue with invalid configuration
delay (1000);
}
}
}
void loop() {
// read from port 1, send to port 0:
if (myPort.available()) {
int inByte = myPort.read();
Serial.write(inByte);
}
// read from port 0, send to port 1:
if (Serial.available()) {
int inByte = Serial.read();
myPort.write(inByte);
}
}
HTH
GL PJ