I fixed the SimpleTimer and I’m now using this code:
//#define BLYNK_USE_DIRECT_CONNECT
#define BLYNK_PRINT Serial
// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX
#define BLYNK_PRINT DebugSerial
#include <BlynkSimpleSerialBLE.h>
#include <SimpleTimer.h>
char auth[] = "396bef6a49a54b3ab4a48f07bac5aeba";
WidgetLED led1(V1);
// the timer object
SimpleTimer timer;
// a function to be executed periodically
void repeatMe() {
Serial.print("Uptime (s): ");
Serial.println(millis() / 1000);
if (led1.getValue()) {
led1.off();
Serial.println("LED on V1: off");
} else {
led1.on();
Serial.println("LED on V1: on");
}
}
void setup() {
Serial.begin(9600);
Blynk.begin(Serial, auth);
timer.setInterval(1000, repeatMe);
}
void loop() {
Blynk.run();
timer.run();
}
The serial monitor is giving me this:
LED on V1: on
Uptime (s): 76
LED on V1: off
Uptime (s): 77
LED on V1: on
Uptime (s): 78
LED on V1: off
Uptime (s): 79
LED on V1: on
396bef6a49a54b3ab4a48f07bac5aebaUptime (s): 80
LED on V1: off
Uptime (s): 81
LED on V1: on
Uptime (s): 82
LED on V1: off
Uptime (s): 83
LED on V1: on
Uptime (s): 84
LED on V1: off
396bef6a49a54b3ab4a48f07bac5aebaUptime (s): 85
LED on V1: on
Uptime (s): 86
LED on V1: off
Uptime (s): 87
LED on V1: on
Uptime (s): 88
LED on V1: off
It seems that commenting out “#define BLYNK_USE_DIRECT_CONNECT” allows me to see this on the serial monitor.
However the virtual LED is still not blinking for some reason, despite it’s value clearly changing.