Hello, I feel like this is simple, but all my googling just leads me to very similar but not-useful solutions which depend on the start time of the Arduino (or in my case, NodeMCU).
I want to run "day" code and "night" code, and allow the user to set the parameters defining which code is run at which time of a 24 hour period, via a bluetooth companion app. So simply running the Arduino / Node for part of the day, and not running it for the rest of the day, would not work for me.
My issue is I can't just make a statement that says, say, "if TimeActual > TimeOn, run day code", because if the user defines "day" to begin at 11 PM for example, then "TimeActual" will become numerically smaller as soon as it loops past 23:59. But if they define "day" to begin at 1 AM and last 5 hours, "TimeActual" should be larger and the first example statement would be valid.
In the past, I created a similar controller, but I reprogrammed values myself manually, so I could just switch the "greater than" to "less than" as needed and plug in "and" statements where required. I can't figure out how to set up a similar framework when time values are being provided by an app, and the numerical relationship insofar as greater than/less than will be inconsistent.
Guidance on either issue is greatly appreciated