Skip to main content

Time Sync Card

Pro Feature

This is an exclusive feature of DASH Pro. Check it out here.

Text Input Card Preview

Use the time sync card to syncronize the time of your device with your MCU. This has various applications which require precise time keeping etc.

tip

Time sync card grabs the time from your browser, so only use it when your device and MCU are known to be in the same geographical location/timezone.

Initializer

/* 
Time Sync Card
Valid Arguments: (ESPDash dashboard, Card Type, const char* name)
*/
Card timesync(&dashboard, TIME_SYNC_CARD, "Time Sync");

Callback

timesync.attachCallback([&](const char* value){
Serial.println("Time Sync Triggered: "+String(value));
});

Updater

note

Time sync card doesn't require any updater.

Reference

This is a reference sketch showing positions for intializer and callback.


...

/* Time sync card initializer */
Card timesync(&dashboard, TIME_SYNC_CARD, "Time Sync");


void setup() {
...

/* Time sync card callback */
timesync.attachCallback([&](const char* value){
Serial.println("Time Sync Triggered: "+String(value));
});
}

void loop() {
...
}