准备学习蓝牙了,先列个题目,分类bluetooth,来先开始!网上找段程序测试下:
1,硬件:Arduino 2560Mage+HC05
2,接线:Arduino 的vcc/gnd与HC05vcc/gnd直接连接;2560Mage选择的是Serial3与HC05接线rx3---tx,tx3----rx;
3,手机蓝牙测试软件www.hc01.com下载,我是他们家的蓝牙模块。
void setup() {
// put your setup code here, to run once:
Serial3.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
while(Serial3.available())
{
char c = Serial3.read();
if(c=='A')
{
Serial3.println("Hello bluetooth");
}
}
}
很奇怪:我收到的返回数据是“AHello bluetooth”。不管怎么样,算是连接上了吧!