The ESP32-S2 is an affordable, all-in-one, option for connecting your projects to the internet using our IoT platform, Adafruit IO.
- For more information and guides about Adafruit IO, check out the Adafruit IO Basics Series.
In the Arduino IDE, navigate to Sketch -> Include Library->Manage Libraries...
Enter Adafruit IO Arduino into the search box, and click Install on the Adafruit IO Arduino library option to install version 4.0.0 or higher.
When asked to install dependencies, click Install all.
If you do not already have an Adafruit IO account, create one now. Next, navigate to the Adafruit IO Dashboards page.
We'll create a dashboard to visualize and interact with the data being sent between your ESP32-S2 board and Adafruit IO.
We'll want to turn the board's LED on or off from Adafruit IO. To do this, we'll need to add a toggle button to our dashboard.
Under Block Settings,
Next up, we'll want to display button press data from your board on Adafruit IO. To do this, we'll add a gauge block to the Adafruit IO dashboard. A gauge is a read only block type that shows a fixed range of values.
Under block settings,
Your dashboard should look like the following:
For this example, you will need to open the adafruitio_26_led_btn example included with the Adafruit IO Arduino library. In the Arduino IDE, navigate to File -> Examples -> Adafruit IO Arduino -> adafruitio_26_led_btn.
Before uploading this code to the ESP32-S2, you'll need to add your network and Adafruit IO credentials. Click on the config.h tab in the sketch.
Obtain your Adafruit IO Credentials from navigating to io.adafruit.com and clicking My Key. Copy and paste these credentials next to
Enter your network credentials next to
Click the Upload button to upload your sketch to the ESP32-S2. After uploading, press the RESET button on your board to launch the sketch.
Open the Arduino Serial monitor and navigate to the Adafruit IO dashboard you created. You should see the gauge response to button press and the board's LED light up in response to the Toggle Switch block.
You should also see the ESP32-S2's LED turning on and off when the LED is toggled: