File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -215,21 +215,34 @@ settings.toml:
215
215
.. code-block :: python
216
216
217
217
# WiFi settings
218
- CIRCUITPY_WIFI_SSID = " "
219
- CIRCUITPY_WIFI_PASSWORD = " "
218
+ CIRCUITPY_WIFI_SSID = " Your WiFi ssid "
219
+ CIRCUITPY_WIFI_PASSWORD = " Your WiFi password "
220
220
221
221
# Azure IoT Central settings
222
- id_scope= " "
223
- device_id= " "
224
- device_sas_key= " "
222
+ id_scope= " Your ID Scope "
223
+ device_id= " Your Device ID "
224
+ device_sas_key= " Your Primary Key "
225
225
226
226
**Connect your device to your Azure IoT Central app **
227
227
228
228
.. code-block :: python
229
229
230
+ import wifi
231
+ from os import getenv
230
232
from adafruit_azureiot import IoTCentralDevice
233
+ import adafruit_connection_manager
231
234
232
- device = IoTCentralDevice(wifi, id_scope, device_id, device_sas_key)
235
+ ssid = getenv(" CIRCUITPY_WIFI_SSID" )
236
+ password = getenv(" CIRCUITPY_WIFI_PASSWORD" )
237
+ id_scope = getenv(" id_scope" )
238
+ device_id = getenv(" device_id" )
239
+ device_sas_key = getenv(" device_sas_key" )
240
+
241
+ wifi.radio.connect(ssid, password)
242
+
243
+ pool = adafruit_connection_manager.get_radio_socketpool(wifi.radio)
244
+
245
+ device = IoTCentralDevice(pool, id_scope, device_id, device_sas_key)
233
246
device.connect()
234
247
235
248
Once the device is connected, you will regularly need to run a ``loop `` to poll for messages from the cloud.
You can’t perform that action at this time.
0 commit comments