You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+16-17Lines changed: 16 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -66,33 +66,32 @@ To create an Azure IoT Hub instance or an Azure IoT Central app, you will need a
66
66
ESP32 AirLift Networking
67
67
========================
68
68
69
-
To use this library, you will need to create an ESP32_SPI WifiManager, connected to WiFi. You will also need to set the current time, as this is used to generate time-based authentication keys. One way to do this is via the `Adafruit CircuitPython NTP <https://github.com/adafruit/Adafruit_CircuitPython_NTP>`_ library with the following code:
69
+
To use this library, you will need to create an ESP32_SPI WifiManager, connected to WiFi. You will also need to set the current time, as this is used to generate time-based authentication keys. One way to do this is with the following code:
70
70
71
71
.. code-block:: python
72
72
73
-
ntp = NTP(esp)
74
-
75
-
# Wait for a valid time to be received
76
-
whilenot ntp.valid_time:
77
-
time.sleep(5)
78
-
ntp.set_time()
73
+
# get_time will raise ValueError if the time isn't available yet so loop until
74
+
# it works.
75
+
now_utc =None
76
+
while now_utc isNone:
77
+
try:
78
+
now_utc = time.localtime(esp.get_time()[0])
79
+
exceptValueError:
80
+
pass
81
+
rtc.RTC().datetime = now_utc
79
82
80
83
Native Networking
81
84
=================
82
-
To use this library, with boards that have native networking support, you need to be connected to a network. You will also need to set the current time, as this is used to generate time-based authentication keys. One way to do this is by using the `Adafruit IoT Time API <https://io.adafruit.com/api/docs/#time>`_ via the `Adafruit Requests library <https://github.com/adafruit/Adafruit_CircuitPython_Requests>`_ with the following code:
85
+
To use this library, with boards that have native networking support, you need to be connected to a network. You will also need to set the current time, as this is used to generate time-based authentication keys. One way to do this is the `Adafruit NTP library <https://github.com/adafruit/Adafruit_CircuitPython_NTP>`_ with the following code:
0 commit comments