Quite trivial problem, but you have not adequately specified it.
If 2 hours inactivity will make the output LOW, under exactly what condition will it stay HIGH for 8 hours?
Have you learned to use the "blink without delay" example? That is the first step in both your previous question and this one. ![]()
Also read the instructions for posting code in particular.