Blynk control Arduino uno LED Via bluetooth
/*
HC-05 VCC → Arduino 5V
HC-05 GND → Arduino GND
HC-05 RXD → Arduino TXD pin1
HC-05 TXD → Arduino RXD pin 0
HC-05 KEY → Not Connected
*/
#define BLYNK_USE_DIRECT_CONNECT
// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(10,11); // RX, TX
#define BLYNK_PRINT DebugSerial
#include <BlynkSimpleSerialBLE.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "3bb8cedd86df48799acb0492032dfc0d";
void setup()
{
// Debug console
DebugSerial.begin(38400);
DebugSerial.println("Waiting for connections...");
// 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(38400);
//Serial.begin(9600);
Blynk.begin(Serial, auth);
}
void loop()
{
Blynk.run();
}
沒有留言:
張貼留言