Using phone RTC to assist arduino

It would be nice to have a widget that could take advantage of the phone’s clock to help with Arduino daily tasks. Normally, this would be easy to implement on the Arduino simply by adding a RTC and some code. However, I’m almost at the max limit of my sketch size ~30K, so code real estate is valuable.

The idea is this - have a widget that could send time data (date would be a bonus) to the Arduino, then this info can be used for tasks. I have a simple example with my upcoming garage opener project. I want to monitor how many times each door was opened each day and have it reset daily. A widget would offload bunch of code from the Duino and allow me to save space.

1 Like

@deejayspinz

Doesn’t timer widget fit your needs?

couldn t you use the new timer widget, trigger it every day at 0:00 and in the BLYNK_WRITE just do the reset…

I don’t know how it works? Is there a Wiki that explains this?

you just add a Timer widget in the app, and when the timer time comes it calls BLYNK_WRITE(VIRTUAL_PIN) on the arduino side.

here 's a sample function i added today, virtual pin 10, it starts and stops automatically a relay:

//SCHEDULED TIMER ON/OFF V10
BLYNK_WRITE(10) {
  int a = param.asInt();
  if (a == 0) {
    digitalWrite(5, LOW);

    wateringStart = 0;
  } else {
    digitalWrite(5, HIGH);
    if (wateringStart == 0) {
      wateringStart = millis();
    }
  }
  Blynk.virtualWrite(1, a);
  Serial.println("write");
}
1 Like

Thx for the example @tzapulica. Also, I think I understand how the timer widget works now. It should do the trick for what I want. Thx

@tzapulica

Thanks for help!

Later will make timer more complex (or add separate widget) so you could trigger it at specific date, or day week.

@deejayspinz

We’re working on documentation.

hi, in the last part of the code there is a “Blynk.virtualWrite(1, a)”; or V1. what kind of widget is V1 ? and what does it do?

thanks.

Hi,

V1 is a virtual pin. Instead of addressing a physical gpio pin on your arduino, virtual pins can be used by the blynk smartphone app, being a led or button or any other widget on the app assigned to this virtual pin.
Hope this helps.

L

Out the top of my head it s an led widget for feedback. I use these all over the place waiting on being able to set button states :stuck_out_tongue:

You can now use RTC widget, in the latest library and App


Cheers!