These instructions will defer parts of the build process to the Blues Zephyr SDK documentation (the "Zephyr SDK docs"). Though these instructions are for the note-zephyr repo, the same patterns for building the code are used here.
Start VS Code and select File > Open Folder and pick 37-heat-index-monitor/firmware/zephyr.
Edit src/main.c to associate the firmware with your Notehub project. Uncomment // #define PRODUCT_UID "com.your-company:your-product-name" and replace com.your-company:your-product-name with your project's ProductUID.
You can change this interval by setting the environment variablemonitor_interval. The unit for monitor_interval is seconds. The firmware reads from the BME280 every 30 seconds, so it's not particularly useful to set monitor_interval lower than 30 seconds. Note: If you modify any environment variables, wait at least a minute for the changes to propagate to the Swan.
The status field indicates the reason for the alarm. low means the value is below the minimum, high means the value is above the maximum, and ok means the value is in range. You should only ever see an alarm.qo note if at least one of the values is not ok. In this case, the humidity_max was set to 35, and the measured humidity breached that level, resulting in a high humidity alarm.
Note: Alarm notes are sent at a maximum rate of 1 every 5 minutes.
With an understanding of the Notefiles used in this project, you're now ready to test outdoors.
Unplug the STLINK from the Swan. The hardware should now be fully disconnected from your development PC so that you can move it all outside.
Carefully install the Notecarrier, antenna, battery, and BME280 inside the hardware housing:
Thread the solar panel's JST connector through the hole bottom plate of the hardware housing and plug it into the JST port on the Notecarrier labeled SOLAR:
Place the hardware on a smooth surface outside, with the solar panel facing toward the sun:
Return to your development PC, and access the Events tab of your Notehub project. When a note comes in to data.qo, identify the current heat index. You can double-click the note and go to the Body tab to view the full JSON of the note.
Click Devices on the left hand side, double-click the entry for your device, and click the Environment tab. Add a new variable under "Device environment variables" with the name heat_index_max and a value a few degrees below the heat_index you just saw in the data.qo note. Click Save. This will create the conditions for an alarm.qo note, because the heat index is above the max.
Wait at least a minute for the environment variable update to propagate to the Notecard. Soon after, you should see an alarm.qo note back on the Events tab of your Notehub project.
Though we only support using the VS Code + Dev Containers workflow described here, you can also install Zephyr and its dependencies locally. You can build, flash, and debug code in your native environment using Zephyr's west tool. See Zephyr's Getting Started Guide for more information.