Simple example built for esp-rust-board that sends temperature and humidity to ThingSpeak, via MQTT, where it can be visualized in this dashboard.
If you want to reproduce this example:
- Sign in or create an account.
- Create a new channel
- Add the proper fields (in this case
humidity
andtemperature
)
- Add the proper fields (in this case
- Create a MQTT Device
- Make sure you authorize acess to your channel when creating the device.
- Rename
cfg.toml.example
tocfg.toml
- Fill the
cfg.toml
withwifi_ssid
: Wifi SSIDwifi_pass
: Wifi passwordclient_id
: MQTT Client IDusername
: Username of the MQTT Device (It's the same as MQTT Client ID)password
: Password of the MQTT Devicechannel_id
: Channel ID (You can find this info in your channel pannel.)
- Modify the Field Charts from the dashboard.
This repository offers Dev Containers supports for:
Note
In order to use Gitpod the project needs to be published in a GitLab, GitHub, or Bitbucket repository.
In order to use GitHub Codespaces the project needs to be published in a GitHub repository and the user needs to be part of the Codespaces beta or have the project under an organization.
If using VS Code or GitHub Codespaces, you can pull the image instead of building it
from the Dockerfile by selecting the image
property instead of build
in
.devcontainer/devcontainer.json
. Further customization of the Dev Container can
be achived, see .devcontainer.json reference.
When using Dev Containers, some tooling to facilitate building, flashing and simulating in Wokwi is also added.
-
Terminal approach:
scripts/build.sh [debug | release]
If no argument is passed,
release
will be used as default -
UI approach:
The default build task is already set to build the project, and it can be used in VS Code and Gitpod:
- From the Command Palette (
Ctrl-Shift-P
orCmd-Shift-P
) run theTasks: Run Build Task
command. Terminal
->Run Build Task
in the menu.- With
Ctrl-Shift-B
orCmd-Shift-B
. - From the Command Palette (
Ctrl-Shift-P
orCmd-Shift-P
) run theTasks: Run Task
command and selectBuild
. - From UI: Press
Build
on the left side of the Status Bar.
- From the Command Palette (
Note
When using GitHub Codespaces, we need to make the ports public, see instructions.
-
Terminal approach:
-
Using
flash.sh
script:scripts/flash.sh [debug | release]
If no argument is passed,
release
will be used as default
-
-
UI approach:
- From the Command Palette (
Ctrl-Shift-P
orCmd-Shift-P
) run theTasks: Run Task
command and selectBuild & Flash
. - From UI: Press
Build & Flash
on the left side of the Status Bar.
- From the Command Palette (
-
Any alternative flashing method from host machine.
When using a custom Wokwi project, please change the WOKWI_PROJECT_ID
in
run-wokwi.sh
. If no project id is specified, a DevKit for esp32c3 will be
used.
Warning
ESP32-S3 is not available in Wokwi
-
Terminal approach:
scripts/run-wokwi.sh [debug | release]
If no argument is passed,
release
will be used as default -
UI approach:
The default test task is already set to build the project, and it can be used in VS Code and Gitpod:
- From the Command Palette (
Ctrl-Shift-P
orCmd-Shift-P
) run theTasks: Run Test Task
command - With
Ctrl-Shift-,
orCmd-Shift-,
Note
This Shortcut is not available in Gitpod by default.
- From the Command Palette (
Ctrl-Shift-P
orCmd-Shift-P
) run theTasks: Run Task
command and selectBuild & Run Wokwi
. - From UI: Press
Build & Run Wokwi
on the left side of the Status Bar.
- From the Command Palette (
Warning
The simulation will pause if the browser tab is in the background.This may affect the execution, specially when debuging.
Wokwi offers debugging with GDB.
-
Terminal approach:
$HOME/.espressif/tools/riscv32-esp-elf/esp-2021r2-patch3-8.4.0/riscv32-esp-elf/bin/riscv32-esp-elf-gdb target/riscv32imc-esp-espidf/debug/thingspeak_example -ex "target remote localhost:9333"
-
UI approach:
- Run the Wokwi Simulation in
debug
profile - Go to
Run and Debug
section of the IDE (Ctrl-Shift-D or Cmd-Shift-D
) - Start Debugging by pressing the Play Button or pressing
F5
- Choose the proper user:
esp
when using VS Code or GitHub Codespacesgitpod
when using Gitpod
- Run the Wokwi Simulation in