Core2 bluetooth connection

Hi Husarion Team,
I like to connect HC-05 bluetooth module to CORE2 sothat I can command my robot.

Connection will be:
TX bluetooth to hExt.pinRX (pin 6)
RX bluetooth to hExt.pinTX (pin 7)

Can I do this? and using the following instructions:
hExt.serial.read(readbuffer, nrOfBytes);
hExt.serial,write(writebuffer, nrOfBytes);

Best,
Fred

Hi Fred,

yes, we often use HC-05 for debbuging in our internal projects. Just connect it to the Serial port in hExt, hSens3 or hSens4 (CORE2 | Husarion) and use that code example https://husarion.com/examples/hFramework__Serial%20I/hFramework__Serial%20I/hFramework__Serial%20I/hFramework__Serial%20I/hFramework__Serial%20I/O_serial_config . I hope it will help :slight_smile: .

If you debug under Windows, I recommend Tera Term terminal app: Tera Term Open Source Project

Best,
Dominik

Hi Dominik,
The link given on the examples results in “404 Not Found” screen.

char data_to_send[] = {“HusarionTankBot V3”};
for (;:wink:
{
hExt.serial.write(data_to_send, sizeof(data_to_send));
sys.delay(500);
}

I am able to get msg’s on my Tera Term terminal of my windows PC, however they are unreadable.
Both sides baud rates are 19200.
Other speeds have been tryed but still unreadable messages.
The wiring:
TX bluetooth to hExt.serial.pinRX (pin 6 D0)
RX bluetooth to hExt.serial…pinTX (pin 7 D1)
+5V bluetooth to hExt pin 13
GND bluetooth to hExt pin 14

Am I missing something?
I will try to use another HC-05 module and come back later if any progress.
Regards,
Fred

Hi Fred,

thank you for finding an issue with the paths to examples. Nevertheless, we are going to move all examples to GitHub. There is the example Dominik wanted to show you:

The more popular examples are also here:

This example uses a loop made by wire on the CORE2 board between hExt UART TX pin to hSens3 UART RX pin. You can additionally connect the RX pin of HC-05 module to this loop and you should see the same message on USB Serial and Bluetooth serial port console.

Your code looks well but have you done the initializing of hExt.serial before?

Regards,
Radek.

Hi Radek,
hExt.serial.init(19200, Parity::None, StopBits::One);
is my cloudTask() and on its turn is called by hMain().
later cloudTask() does sys.taskCreate(printLoop_task, 2, 1000);
The printLoop_task keeps sending but the data received by Tera Term is garbage/unreadable, and I do not understand why.
The baudrate match between Core2 and Tera Term.
I will try to find another HC-05 module.
I am working with CORE2ROS with Tkiner board.
Regards,
Fred

The problem is due to a bad connection.
Sorry for the inconveniences I have caused.
Thanks and regards,
Fred