Skip to content

DefangSamples/sample-arduino-wifi-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduino Flask Wifi Server

1-click-deploy

project image

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.

arduino wifi diagram

Prerequisites

  1. Download Defang CLI
  2. (Optional) If you are using Defang BYOC authenticate with your cloud provider account
  3. (Optional for local development) Docker CLI

Development

To run the application locally, you can use the following command:

docker compose up --build

Configuration

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

Deployment

Note

Download Defang CLI

Defang Playground

Deploy your application to the Defang Playground by opening up your terminal and typing:

defang compose up

BYOC

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •