I found the auth code from my project didn’t work. I had to connect Bluetooth with debug on so I could see the auth code being sent and use that. Bug in the app maybe?
I finally get the HM-10 working. The trick was to use the SoftwareSerial-example as base code instead of the HM-10 example code.
So my code now looks like this, and this works!:
/**************************************************************
* Blynk is a platform with iOS and Android apps to control
* Arduino, Raspberry Pi and the likes over the Internet.
* You can easily build graphic interfaces for all your
* projects by simply dragging and dropping widgets.
*
* Downloads, docs, tutorials: http://www.blynk.cc
* Blynk community: http://community.blynk.cc
* Social networks: http://www.fb.com/blynkapp
* http://twitter.com/blynk_app
*
* Blynk library is licensed under MIT license
* This example code is in public domain.
*
**************************************************************
*
* This example shows how to use Serial BLE modules (HM-10, HC-08)
* to connect your project to Blynk.
*
* NOTE: BLE support is in beta!
*
**************************************************************/
//#define BLYNK_DEBUG
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <SoftwareSerial.h>
#include <BlynkApiArduino.h>
#include <Adapters/BlynkSerial.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
typedef BlynkTransportSerial<SoftwareSerial> SwSerialConnection;
SoftwareSerial SwSerial(10, 11); // RX, TX
SwSerialConnection connection(SwSerial);
BlynkSerial<SwSerialConnection> Blynk(connection);
void setup()
{
// This is for debug prints
Serial.begin(9600);
After updating the app to the latest version, the problem is indeed solved. I added my example code here. Remark that I use SoftwareSerial and set the pins, I think this is easier for example code as I assume most will start like this.
/**************************************************************
* Blynk is a platform with iOS and Android apps to control
* Arduino, Raspberry Pi and the likes over the Internet.
* You can easily build graphic interfaces for all your
* projects by simply dragging and dropping widgets.
*
* Downloads, docs, tutorials: http://www.blynk.cc
* Blynk community: http://community.blynk.cc
* Social networks: http://www.fb.com/blynkapp
* http://twitter.com/blynk_app
*
* Blynk library is licensed under MIT license
* This example code is in public domain.
*
**************************************************************
*
* This example shows how to use Serial BLE modules (HM-10, HC-08)
* to connect your project to Blynk.
*
* NOTE: BLE support is in beta!
*
**************************************************************/
//#define BLYNK_DEBUG
#define BLYNK_PRINT Serial
#define BLYNK_USE_DIRECT_CONNECT
#include <BlynkSimpleSerialBLE.h>
#include <SoftwareSerial.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
SoftwareSerial SerialBLE(10, 11); // RX, TX
void setup()
{
// This is for debug prints
Serial.begin(9600);
SerialBLE.begin(9600); // Set Serial baud rate
Blynk.begin(auth, SerialBLE);
}
void loop()
{
Blynk.run();
}