Think I figured out the logic I need to use. Just need to include minutes as well and then Im done.
#include <Arduino.h>
int hour = 15;
int minute = 35;
int inputStart = 10;
int inputStop = 20;
void ledOn1() {
Serial.println("Time is between and doesnt cross midnight");
}
void ledOn2() {
Serial.println("Time is between before midnight");
}
void ledOn3() {
Serial.println("Time is between after midnight");
}
void ledOff() {
Serial.println("Time is not between");
}
void setup() {
Serial.begin(9600);
// put your setup code here, to run once:
}
void loop() {
delay(1000);
if (inputStop > inputStart) { // Time does not cross midnight
if (hour > inputStart && hour < inputStop) {
ledOn1();
}
else {
ledOff();
}
}
if (inputStop < inputStart) { // Time cross midnight
if (hour > inputStart && hour > inputStop) {
ledOn2(); // time is between before midnight
}
else if (hour < inputStart && hour < inputStop) {
ledOn3(); // time is between after midnight
}
else {
ledOff();
}
}
}