Getting Started
Flashing this firmware to your AirGradient
- Setup your environment by downloading and installing one or more of the following options:
- Arduino IDE
- Arduino CLI
- VS Code with the Arduino extension to your system.
- Clone this repo or download the latest release (a zip of the source code).
- Open
airgradient_mqtt.ino
with your chosen Arduino tools. - Install all required Arduino reference libraries.
- Plug in the microcontroller for your AirGradient (such as an ESP8266 Wemos LOLIN D1 mini) and upload the sketch to the controller.
Automated Tests
This project leverages AUnit to facilitate building automated tests and EpoxyDuino to mock an Arduino on a PC and run continuous integration.
Setting up your environment
I ran tests using Windows Subsystem for Linux (WSL). Follow these steps to get started - you may be able to skip several steps on a standard Linux distro or macOS.
- Install the AUnit library within the Arduino environment of your choice.
- Setup and configure WSL.
- At the time of this running, the provided Ubuntu distro requires an
apt update
before proceeding. - EpoxyDuino requires a C++ compiler and make. Add them to your install with
apt install g++
andapt install make
.
- At the time of this running, the provided Ubuntu distro requires an
- Clone the EpoxyDuino repo and place it within the
user/Documents/Arduino/libraries
folder (this is not a required location, but this project is setup assuming EpoxyDuino is located here). - Add a
.env
file to the root of this project with the following format:
arduino_ide_dir=LOCATION_OF_ARDUINO_IDE
Running tests
You are now ready to build and compile and run the tests. Follow these instructions to run all tests from the root of this project. I prefer to use the WSL terminal within VS Code for this purpose.
$ make -C tests clean
$ make -C tests tests
$ make -C tests runtests | grep failed
Alternatively, you can browse to the subfolder containing a specific subset of tests and run those directly.
$ make clean
$ make
$ make run