This sample contains an interactive wifi-connected UI program for a SenseCAP Indicator Device, built for an Embedded Systems project at Defang Software Labs.
The device has a square liquid-crystal touch screen display, and a ESP32-S3 chip that can be programmed in an Arduino environment.
The program welcome.ino
, acting as a client, pings data every 5 seconds after it is connected to a wifi network. It uses a library called ArduinoHTTPClient. It is also recommended to use Arduino IDE when coding with .ino
files. The program UI will display a message that is randomized in color and location on the screen at the same time during pings (every 5 seconds).
The Flask server in web_server.py
receives these pings when it is initialized and connected to the same wifi network as the client. To initalize it, run python web_server.py
. To view it, open localhost
with the port number used. To deploy it to the cloud, run defang up
in the \welcome
directory.
A helpful file called serial_reader.py
decodes serial monitor readings to a readable format, allowing you to see Serial.println()
messages in real time when running. To initalize it, run python serial_reader.py
and see it show up in the terminal.
Here is a diagram showing the structure of the application.
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
To run the application locally, you can use the following command:
docker compose up --build
For this sample, you will not need to provide configuration.
If you wish to provide configuration, see below for an example of setting a configuration for a value named API_KEY
.
defang config set API_KEY
Note
Download Defang CLI
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
If you want to deploy to your own cloud account, you can use Defang BYOC.
Title: Arduino Flask Wifi Server
Short Description: An Arduino wifi server built with Flask.
Tags: Arduino, Flask, Python, IoT, Wifi, Serial
Languages: python