At this point, we have had a detailed look at the underlying, supporting code that makes life easy when writing a new module because we don't have to do all of the housekeeping ourselves. The only thing we haven't seen yet is an actual module, or code directly pertaining to this chapter's project.

In this section, we will look at the last part of the puzzle, the PlantModule itself:

#include "base_module.h"#include <Libraries/APA102/apa102.h>#define PLANT_GPIO_PIN 5#define NUM_APA102 1class PlantModule {         static int pin;         static Timer timer;         static uint16 humidityTrigger;         static String publishTopic;         static HttpServer server;         static APA102* LED;         static void onRequest(HttpRequest& request, HttpResponse& response);public: static bool ...

Get Hands-On Embedded Programming with C++17 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.