We now arrive at the third chapter in the series. The first two were dedicated to the development of libraries for hardware needed for the project. With libraries completed for the water meter and the valve we can continue designing the architecture that ties everything together while incoperating the quad relay module into our to be developed sprinklersystem library a small support application will be written along with this activity. It stands to reason our sprinklersystem library and overarching project will depend upon the two libraries created in chapter one and two, they will be included in the library for sprinklersystem and compiled in.
As there is no vectoring in esp32 an array will be created to store zone objects called storedzones, allowing for easy manipulation addition and removal of zones form the sprinklersystem object. the array can handle 30 zones which is way overkill but acceptable. Each zone has attributes that I mad add remove or change later in development, but this will get us off the ground. Attributes from the valve and meter are already defined and probably wont change much.
Within the sprinklersystem class, the overarching object is the class Zone and its attributes, as well as the zone array itself with associated helper functions, open close remove, and whatnot. The is no function to add sprinklersystem the app were creating does that. The addzone function provides an opportunity to allow for any required validation of supplied parameters as demonstrated.
The main program provided is simply a demonstration to create an object and demonstrate all of the functionality thus far. This includes bad data to demonstrate errors.