Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Sample code for HC-06 or similar Bluetooth module

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
TSEYFARTH

Bascom Member



Joined: 01 Jul 2006
Posts: 1054

usa.gif
PostPosted: Wed Jun 17, 2020 10:23 pm    Post subject: Sample code for HC-06 or similar Bluetooth module Reply with quote

Hello all,

Can anyone point me to sample code to use the HC-06 blue tooth module?

Thank you,
Tim

(BASCOM-AVR version : 2.0.8.2 )
Back to top
View user's profile
Dave

Bascom Member



Joined: 05 Feb 2005
Posts: 314
Location: OR

usa.gif
PostPosted: Wed Jun 17, 2020 11:54 pm    Post subject: Reply with quote

Hello Tim
You don't really need any code to use the HC-06. Once you configure the HC-06 baud rate you just connect to a com port and use Print and Input commands. I use a bluetooth terminal programon my phone to control projects that have bluetooth. If you are trying to connect two micro controllers using bluetooth I don't think the HC-06 can do that but I've read that the HC-05 can.

Here are my notes to configure the HC-06:
I like realterm to send config commands.

Code:
'BlueTooth Config Notes:
' TYPE - HC-06
' DEFAULT BAUD -  9600
' DEFAULT NAME -
' DEFAULT PIN  -  1234
' NEW BAUD     -  115200
' NEW NAME     -  clock
' NEW PIN      -  time
'
'To enable command mode install jumper C next to module.
'Jumper C pulls the EN line high.
'Setup Commands for this project.
'send             return
'AT            -  OK
'AT+NAMEclock  -  OKsetname
'AT+PINtime    -  OKsetPIN or sometimes no return but pin change works anyway.
'AT+BAUD8      -  OK115200
'
'Other commands.
'send             return
'AT+BAUD4      -  OK9600
'AT+BAUD5      -  OK19200
'AT+BAUD6      -  OK38400
'AT+BAUD7      -  OK57600
'AT+BAUD8      -  OK115200
'AT+BAUD9      -  OK230400
'AT+BAUDA      -  OK460800
'AT+BAUDB      -  OK921600
'AT+BAUDC      -  OK1382400


Good luck,
Dave
Back to top
View user's profile
TSEYFARTH

Bascom Member



Joined: 01 Jul 2006
Posts: 1054

usa.gif
PostPosted: Thu Jun 18, 2020 1:06 am    Post subject: Reply with quote

Thank you Dave!
Tim
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum