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
-
@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()) -
@oligauc Thank you!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login