Programming the Arduino
Step 1: Install the MatesController library using Arduino’s Library Manager.
Step 2: Include MatesController.h to your project.
Step 3: Create a MatesController instance named mates.
This will initialize the MatesController instance to the default reset pin 4 using a LOW pulse.
Step 4: (Optional) Create a function for toggling the built-in LED of the Arduino board. This can be used for debugging or showing errors if the Serial monitor can’t be used.
Step 5: (Optional) At the beginning of the setup function, set the built-in LED pin to OUTPUT and set it to LOW.
Step 6: To start using the MatesController instance, use the begin function
This will initialize the Serial UART at the default baudrate of 9600
Step 7: (Optional) The begin function can be enclosed in an if condition to handle initialization errors.
Step 8: To print the day of week, an array of strings needs to be prepared.
Step 9: Integer variables for day of week, time and a few other variables are also required to store and simulate values.
Step 10: In the loop function, the values are simulated and sent to TIMI as necessary.
As shown, the simulated values utilizes a 1 second non-blocking delay to simulate a 1 second increment in time. The minutes, hours and day of week are updated accordingly.
Step 11: Lastly, to ensure that the day and time values are written to TIMI for the first loop, the lastUpdate variable should be set to 1s behind at the end of the setup function.