10-07-2017 06:56 AM
lets say i have 12 LED for 12 hour indication.
one LED should on for one hour and next led for next hour say like
LED_1 should remain on from 8am to 9am
LED_2 should remain on from 9am to 10am and so on.
i can make this but to compare each time stamp for each hour. its so big coding.
please tell how to do with other way like using loop.
Thanks,
10-07-2017 07:16 AM
You can use a quotient and remainder for this. If you use the time as x, and 12 as y, you'll get 0-11 as remainder. If you put the 12 LEDs in an array, you can simply replace that index in an array of false booleans with a true.
10-07-2017 07:17 AM
Use the Seconds To Date/Time and then unbundle the hour. From there you can just use a constant of 12 FALSEs and Replace Array Subset to put the TRUE where it needs to go.
10-07-2017 07:22 AM
Seconds to Date\Time has the benefit that it returns he local hour. But you still get 0-23. So use a q&r with a 12 to get 0-11.
10-07-2017 07:44 AM
10-07-2017 07:50 AM
@Asif138 wrote:
can you please write code?
We are not here to do your homework. We gave you step-by-step instructions. Give it a try. When you run into issues, post your code and tell us what is stopping you.