If you set up your Hardware properly and you are able to connect your App to your Bluetooth device with the help of the BLE widget …
and if you followed the advices given here, which means that your code looks like this:
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(10, 11); // RX, TX
#include <BlynkSimpleSerialBLE.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
void setup()
{
// Debug console
Serial.begin(9600);
SerialBLE.begin(9600);
Blynk.begin(SerialBLE, auth);
Serial.println("Waiting for connections...");
}
void loop()
{
Blynk.run();
// You can inject your own code or combine it with other sketches.
// Check other examples on how to communicate with Blynk. Remember
// to avoid delay() function!
}
Then you maybe run into the same problem like me and got the “SerialBLE was not declared in this scope” error.
So my workaround is very simple: forget SimpleBLE. All you need is the following code:
#define BLYNK_PRINT Serial
#define BLYNK_USE_DIRECT_CONNECT
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(10, 11); // RX, TX
#include <BlynkSimpleSerialBLE.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "your_token";
void setup()
{
SwSerial.begin(9600);
Blynk.begin(SwSerial, auth);
}
void loop()
{
Blynk.run();
}