the purpose of this week is setting Bluetooth enter AT mode and make Bluetooth can communicate between the processor and computer.
Hardware requirements:
1.
Two Bluetooth
(HC-05).
Figure 1: the Bluetooth HC-05 (with black button) and USB conversion port
1.
Arduino
1.8-3
Connection requirements:
HC-05
|
USB conversion port
|
RX
|
TXD
|
TX
|
RXD
|
VCC
|
VCC
|
GND
|
GND
|
AT command
1.
AT+NAME=LSN
(setting the Bluetooth name to LSN)
2.
AT+ROLE=1 (setting the Bluetooth role to master, 1
is master and 0 is slaver)
3.
AT+PSWD=1234
(setting the password to 1234)
4.
AT+UART=115200,0,0 (setting the baud rate to 115200 and Stop bit 1 bit,
no parity bit)
Create a new
program in the Arduino, then open the serial monitor, adjust the baud rate to
38400, because the Bluetooth HC-05 initial baud rate is 38400. Then enter the
AT command, if successful, feedback OK, failure feedback error.
Conclusion
The HC-05 comes in
two styles; one with a black button and one without a black button. Make sure
you buy Bluetooth with a black button. Because when you enter AT mode, you need
to press and hold the black button to power on.
没有评论:
发表评论