Hi
I have Mega 2560 board of arduino
and I want a code that counts that how many times value is high in 5 seconds only
pleas help me
Have you tried anything yourself ?
You will probably have discovered that you cannot use delay() for the 5 second period because it blocks execution of the code for the delay period so cannot read a pin or count pulses. So, what to do ? Have a look at the BlinkWithoutDelay example in the IDE. You can adapt the method it uses to count how many times a pin goes from LOW to HIGH in a 5 second period.
and I want a code that counts that how many times value is high in 5 seconds only
Does that means how many times it goes high and then low in 5 seconds?
Because the term "being high for 5 seconds" doesn't mean much. It it is high all the time then the number of times it is high is one.