I hope the title is not misleading. I want to be able to monitor serial communications with my STM32 board using both the Arduino IDE Serial Monitor via the USB cable and an HC-05 Bluetooth module simultaneously without replicating Serial commands in the code. It's actually OK if I cannot use the two monitoring methods at the same time, my principal goal is to not have to duplicate Serial commands in the code.
When I use a NANO, I can just use Serial.begin (and subsequent Serial.print, etc commands) ... and both the Arduino serial monitor and the HC05 module work fine (possibly not simultaneously, but I don't recall). But at least, I can have just one set of Serial commands in my sketch.
When I use the STM32 board, it looks like I need to initialize with both Serial.begin AND Serial1.begin and then replicate all my serial print commends so that both the Arduino monitor and the bluetooth module can communicate. BTW, I am connecting the BT module to pins PA9 and PA10 on the STM32.
Is there a set of pins I can connect my BT module to that monitors the same serial port as the USB connection?
Hi Peter,
This is the snippet I use to talk to with HC-05 modules using the Serial Monitor:
I've used this base with several microcontrollers, so if it's a STM32 or an original Arduino Nano - it's the same setup if you are using Arduino. You'll always need to use Serial.begin on any Serial connection to use it.
STM32F103 is just a chip and it's usually used on BluePill-style boards, but I've used it in many of my own designs since it's so easy to work with. If you have a BluePill, the pinout will be according to this with PA9 as TX and PA10 as RX for Serial1. If it's not a BluePill board, the setup could be different since the STM32F103 is quite flexible with regards to what peripherals go where.