I had a project from university which was to connect 2 raspberries using bluetooth, one had to be programmed in C and the other in python.
Well, my first thought was to connect both raspberries using the integrated BT, unluckily there was no easy way to access the communication channel with C.
So I though about using an HC-06.
One pi was connecting with blueman to the HC-06 and creating a port named rfcomm0, and then in the other I found a tutorial that teach me how to connect it as ttyAMA0.
There's a problem, ttyAMA0 is not a serial communication like for example the one you get in an arduino with software serial or the one you get in raspberry pico such as the UART. I was getting A LOT of garbage in the C program and couldn't understand why.
I was about to give up as I couldn't find any tutorial explaining how to make the HC-06 behave as I wanted. Luckily I found a tutorial that teach me that the port which is doing the serial communication that I want is not ttyAMA0 but ttyS0!!!!!!! So I dissabled Serial Console from preferences and enabled Serial Port. It looks like it works now, C is not getting garbage anymore, now it's getting bytes as intended.
The system is as follows, C > rfcomm > HC06 > Integrated BT > ttyS0 > python
I hope this can help other people in the future!!!!
1 post • Page 1 of 1