Bluetooth >>> 08M2 >>> HC-05 | Raspberry Pi >>> HC-06

slimplynth

Senior Member
I searched the forum but didn't find the info needed to get the HC-05 paired/connected to the HC-06 slave on the raspberry pi..

Below 08M2 code for the HC-05 connected to the picaxe, based on this helpful tutorial - thankfully the bt link seems to be persistent, have cycled power on both picaxe an pi several times and it's fine..


Code:
#no_data
setfreq M32


symbol Rx = C.2
symbol Tx = C.1
symbol BAUD = T38400_32
symbol LED = C.4

main:

high LED

pause 250

low LED 

'debug b0

serout Tx, BAUD, ("AT+RMAAD",13,10)
pause 2000
high LED
serout Tx, BAUD, ("AT+ROLE=1",13,10)
pause 2000
low LED
serout Tx, BAUD, ("AT+RESET",13,10)
pause 2000
high LED
serout Tx, BAUD, ("AT+CMODE=0",13,10)
pause 2000
low LED

'The tutorial linked above states the pin must be the same on both the HC-05 and HC-06.

serout Tx, BAUD, ("AT+PSWD=1234",13,10)
pause 2000
high LED

'you'll want to use your mobile phone or other device to replace the zeros below with the MAC address for the HC-06 slave connected to the rpi3 - keep the commas, no colons required...

serout Tx, BAUD, ("AT+PAIR=00,00,00,00,00,00",13,10)
pause 2000
low LED 'don't be sad - it ends on an high...

serout Tx, BAUD, ("AT+BIND=00,00,00,00,00,00",13,10)
pause 2000
high LED
serout Tx, BAUD, ("AT+LINK=00,00,00,00,00,00",13,10)


End
 
Top