I am trying to get a set of LED strip lights to turn on at 8pm and off at 9pm on a specific day.
I have wired everything up and the wiring is correct as if I set Relay to HIGH the LED's come on.
It is now after 10pm and the lights are still on.
Please help.
Frank16616:
It is set to LOW in the void setup.
I thought that means that whenever it is not set to high, it is automatically low.
When you issue the digitalWrite command it changes to that state and stays in the that state. You don't have to hold it there. Set and forget, or set-time-change.
digitalWrite(Relay, LOW); sets the pins low and it will stay low until the program reaches a digitalWrite(Relay, HIGH); instruction. It will then stay high until the program reaches a digitalWrite(Relay, LOW) instruction.
In you program it will start LOW and when the if statement is true the pin will change to HIGH and stay HIGH, until a LOW command is reached (of which you don't have any).
In your thought process the pin would only stay high for the length of the instruction (like 4 microseconds), and you would never see it change to HIGH.
For more information, look under the Resources -> Reference for information on the digitalWrite instruction.
I am just using the hour for trails. I want it to be on for around 9 hours from 3 pm to midnight and in the second if, the second day from 11 am to 6 pm.