I'm working on a project which basically does 2 jobs, which both have different outputs depending on the current time of day:
- continuously watch pin for sensor data, and perform function A whenever it arrives
- perform function B on fixed schedule (e.g. every minute)
I currently have a setwatch() for 1 and a function start() for 2. But both require the same function for checking the time of day and doing different things depending on it.
What's the best way to structure this code? I'm happy doing either one, but I feel like I'm missing something in my approach to combine them.
Sorry if I've not explained this well - thought it would be better as an abstract question, than sharing my mess of code.