我的Arduino UNO设置了HC-06蓝牙硬件设备。
Arduino上的RX连接到HC-06上的TX,反之亦然。它们共用一个5V和GND。
我正在尝试连接到Blynk。我已经在我的Android手机(摩托罗拉Nexus 6)上设置了Blynk小部件,它检测到HC-06并连接到它(HC-06上的稳定LED)。
这是我上传到Arduino的代码:
#define BLYNK_USE_DIRECT_CONNECT
#define BLYNK_PRINT Serial
// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <BlynkSimpleSerialBLE.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "af0f68df444b43edbcd37bc7147ab608";
void setup()
{
// Blynk will work through Serial
// 9600 is for HC-06. For HC-05 default speed is 38400
// Do not read or write this serial manually in your sketch
Serial.begin(9600);
Serial.println("Setting up");
Blynk.begin(Serial, auth);
// It never gets here
Serial.println("Connected");
}
void loop()
{
Blynk.run();
}
这是我在串行监视器上看到的内容:
Setting up
[0]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ \/ '_/
/____/_/\_, /_//_/_/\_\
/___/ v0.4.7 on Arduino Uno
[95] Connecting...
[6094] Connecting...
[12094] Connecting...
[18094] Connecting...
[24094] Connecting...
[30094] Connecting...
它继续下去。我究竟做错了什么?我已经在这几个小时了。
HC-06不是BLE设备,它基于BC04芯片并支持蓝牙2.1