Skip to content

Commit 99e1de5

Browse files
committed
Update README
1 parent 3e4e3d8 commit 99e1de5

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

README.rst

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,21 +215,34 @@ settings.toml:
215215
.. code-block:: python
216216
217217
# WiFi settings
218-
CIRCUITPY_WIFI_SSID=""
219-
CIRCUITPY_WIFI_PASSWORD=""
218+
CIRCUITPY_WIFI_SSID="Your WiFi ssid"
219+
CIRCUITPY_WIFI_PASSWORD="Your WiFi password"
220220
221221
# 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"
225225
226226
**Connect your device to your Azure IoT Central app**
227227

228228
.. code-block:: python
229229
230+
import wifi
231+
from os import getenv
230232
from adafruit_azureiot import IoTCentralDevice
233+
import adafruit_connection_manager
231234
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)
233246
device.connect()
234247
235248
Once the device is connected, you will regularly need to run a ``loop`` to poll for messages from the cloud.

0 commit comments

Comments
 (0)