mshh
Full Member level 6
I enabled timer and i want to set and reset pin in microcontroller every two hours, how to do that? i mean i want the pin on for 2 hours and off for another 2 hours.
Last edited:
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
if( hour=1&minute=59)/// this will set it every 2 hours but it will reset after 1 minute when the condition is false.
{
set
}
Wrong. Your code never clears the pin. The pin will be set at 1:59 and it remains in this state.if( hour=1&minute=59)/// this will set it every 2 hours but it will reset after 1 minute when the condition is false.
{
set
}
if( hour=1&minute=59)/// this will set it every 2 hours but it will reset after 1 minute when the condition is false.
{
set
}
else // when (hours=0&minute=0 or hours=1&minute= 0 or hours=0&minute=59)
{
reset /// for two hours but time is changing so will the condition
}
How about:
if (hour % 4) set;
else reset;
or even simpler:
output = (hour & 0x02);
Brian.
I enabled timer and i want to set and reset pin in microcontroller every two hours, how to do that? i mean i want the pin on for 2 hours and off for another 2 hours.