User Manual

You'll note here we use a secrets.py file to manage our SSID info. The wifimanager is given the ESP32 object, secrets
and a neopixel for status indication.
Note, you'll need to add a some additional information to your secrets file so that the code can query the Adafruit IO
API:
aio_username
aio_key
You can go to your adafruit.io View AIO Key link to get those two values and add them to the secrets file, which will
now look something like this:
Next, set up an Adafruit IO feed named test
If you do not know how to set up a feed, follow this page and come back when you've set up a feed named
test . (https://adafru.it/f5k)
We can then have a simple loop for posting data to Adafruit IO without having to deal with connecting or initializing the
hardware!
Take a look at your test feed on Adafruit.io and you'll see the value increase each time the CircuitPython board posts
data to it!
response = wifi.post(
"https://io.adafruit.com/api/v2/"+secrets['aio_username']+"/feeds/"+feed+"/data",
json=payload,
headers={"X-AIO-KEY":secrets['aio_key']})
print(response.json())
response.close()
counter = counter + 1
print("OK")
except (ValueError, RuntimeError) as e:
print("Failed to get data, retrying\n", e)
wifi.reset()
continue
response = None
time.sleep(15)
# This file is where you keep secret settings, passwords, and tokens!
# If you put them in the code you risk committing that info or sharing it
secrets = {
'ssid' : '_your_ssid_',
'password' : '_your_wifi_password_',
'timezone' : "America/Los_Angeles", # http://worldtimeapi.org/timezones
'aio_username' : '_your_aio_username_',
'aio_key' : '_your_aio_key_',
}
© Adafruit Industries https://learn.adafruit.com/adafruit-metro-m4-express-airlift-wifi Page 100 of 187