The reference is your key to a comprehensive understanding of the Relay Class
<aside> ❗ This is very similar to what you will be doing in data structures. You need a good idea of how Object Oriented Programming works. I would suggest going over some of those concepts before you begin. The purpose of this class is to abstract the inner workings of a relay and allow the person coding the actual API to not worry too much about it.
</aside>
Each object of this class is supposed to be an abstraction for an actual relay. If you wanna know how a relay works check the video below out.
https://www.youtube.com/watch?v=Ca20ktPygY8
Your RelayContainer class is just an array that stores multiple relay objects.
The relay class provides us with functions to turn the relay on and off and track its state. We need functions that change the state of the GPIO pins and also return them when needed. We cannot check if a GPIO pin is on or not so we have to initialize it to a value and then keep track of it.
This is how your class tracks “the state” of the relay.
We will also add a database implementation. However, since that will be worked on while you are coding this class the API is likely not ready. So we will make those changes later. This is one of those challenges in software development that are really annoying and you have to rely on another team to complete their deliverables on time. But we are ECLAIR so we’re chilling!