Using time and bluetooth

I’m using the ESP32 Dev Board with an iPhone and connecting with Bluetooth because I have an unreliable internet connection, and want others to be able to use my app/project without having to code in their network connections.

I’m trying to turn an LED on and off based on the time, but having trouble figuring out a good method of doing this.

I tried the simple timer widget, and it returns a 1 or 0 at the correct time based on my phone’s time. However, I’m under the impression that because I am using bluetooth and not connected to the server, I cannot do anything with this value. Is that correct?

It seems like the next strategy is to somehow set the time manually in the app, and then use millis() to keep the time. Before I try to figure this out, I wanted to ask if there’s a way to get the time in the app from my phone instead of the server/manual entry?

If not, do you have a recommended approach for achieving my goal?

Thank you!

Not used bluetooth yet personally so cannot comment on that so what about an external RTC module?

My interpretation is that the RTC requires a connection to the server which means I have to go through WiFi/ethernet/internet, which bluetooth does not. I’m not sure if you mean something different when you say “external”?

Sorry I meant by using an extra module. Something like this:

I see, good idea thank you. I’m going to try to solve it with software first, I think as a last resort I can use millis to just turn on/off every 12 hours.

I’m just hoping that there is some way to sync this to my phone’s time, and allow for setting the timer in a convenient way.

The frustrating part is that when using the TimerWidget and checking the value, I can see that it is working correctly off of my phone’s time. I just can’t use the value to trigger any kind of action.

Thank you.

No, the simple timer Widget (or the one built into Eventor) and it’s 0/1 toggle over a vPin, and the corresponding BLYNK_WRITE(vPin) function on your device, should work just fine even over BT/BLE.

Hi Gunner, thank you for the response! (I was hoping to hear from you)

Here is my code:

#define BLYNK_PRINT Serial


#include <BlynkSimpleEsp32_BLE.h>
#include <BLEDevice.h>
#include <BLEServer.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "b843b3f8efc944aa8043e8a97506edeb";

BlynkTimer timer;

WidgetLED virtualLED(V2);

#define   LEDPin  18

void setup()
  // Debug console


  if (param.asInt() == 1) {
    Serial.print("It worked!");
    digitalWrite(LEDPin, HIGH);
  else {;
    digitalWrite(LEDPin, LOW);

void loop()

In the app I have the timer widget and a value display both attached to V5.

The value display shows a 1 when the timer widget is in range, but I’m still not getting any action out of my serial monitor, virtual LED, or actual LED.

Any idea why that might be?