EasyManuals Logo

Adafruit ESP32-S3 User Manual

Adafruit ESP32-S3
263 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #151 background imageLoading...
Page #151 background image
Adafruit IO Example Secrets
This example requires you to provide your Wi-Fi credentials, and your Adafruit IO
username and key. To do this, you'll want to create a secrets.py file on your CIRCUITP
Y drive.
To obtain your Adafruit IO key, follow the initial steps on this page().
For information on how to structure your secrets.py file, and what information to add
to it, check out the Secrets File section on the CircuitPython Internet Test page().
Adafruit IO Example Code
To run this example, you need to first install the NeoPixel, Adafruit IO, and Adafruit
MiniMQTT libraries into the lib folder on your CIRCUITPY drive. Then you need to
update code.py with the example script.
Thankfully, we can do this in one go. In the example below, click the Download
Project Bundle button below to download the necessary libraries and the code.py file
in a zip file. Extract the contents of the zip file, and copy the entire lib folder and the c
ode.py file to your CIRCUITPY drive.
# SPDX-FileCopyrightText: 2021 Ladyada for Adafruit Industries
# SPDX-FileCopyrightText: 2022 Kattni Rembor for Adafruit Industries
# SPDX-License-Identifier: MIT
import time
import ssl
from random import randint
import microcontroller
import socketpool
import wifi
import board
import neopixel
import adafruit_minimqtt.adafruit_minimqtt as MQTT
from adafruit_io.adafruit_io import IO_MQTT
try:
from secrets import secrets
except ImportError:
print("WiFi and Adafruit IO credentials are kept in secrets.py - please add
them there!")
raise
# Add your Adafruit IO Username and Key to secrets.py
# (visit io.adafruit.com if you need to create an account,
# or if you need to obtain your Adafruit IO key.)
aio_username = secrets["aio_username"]
aio_key = secrets["aio_key"]
# WiFi
try:
print("Connecting to %s" % secrets["ssid"])
©Adafruit Industries Page 151 of 263

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Adafruit ESP32-S3 and is the answer not in the manual?

Adafruit ESP32-S3 Specifications

General IconGeneral
BrandAdafruit
ModelESP32-S3
CategoryMicrocontrollers
LanguageEnglish

Related product manuals