Syncing the clocks of Lora/Pymeshed Devices
I am building a testing series of meshed devices that are listening for Bluetooth Beacon advertisements. But I need to sync the clock of the nodes to get accurate measurements. Is there any way I can do something like this using PyCom's libraries? Thanks!
For reference, "PainlessMesh" is a wifi-meshing library that syncs the node(s) clocks: https://gitlab.com/painlessMesh/painlessMesh/blob/master/examples/startHere/startHere.ino
@oligauc Thank you!
@boda Please find example code below on how the sync clock.
from machine import RTC from network import WLAN import machine wlan = WLAN(mode=WLAN.STA) wlan.connect('your ssid', auth=(None, 'your pass')) while not wlan.isconnected(): machine.idle() print('WiFi connected') rtc = machine.RTC() rtc.ntp_sync('pool.ntp.org', update_period=3600) while not rtc.synced(): machine.idle() print("RTC NTP sync complete") print(rtc.now())