Counting how many times the reed sensor was at high and at what time

Good morning everyone.. this community has helped me lot in sense of Arduino programming... So i wanted to read the number of time the reed sensor was at high condition along with the time at which it was high.. I want to print these things on the serial monitor..i want the code for this..plz help me out with this ...

Thanking in advance..

All the reed sensors I have are either open or closed, they are just switches. What position do you equate to being high?
What time are you referring to? Clock time? Time since the program started?
No one here has code to give you. We can and will help you get the code you write to work the way you want.
Paul

The State Change Detection example does the sensing and counting part.

If you don't need clock time and the time since power up is ok, you could use millis() to snag the time each time it goes high. You didn't say if you need to store the times.. You could store those times in an array perhaps, or just print to Serial? SD card perhaps?

For clock time, ie actual time-of-day, you'll need a Real Time Clock module or an internet connection to a time source.

What have you tried so far?

Please post your code.

@rahul6047, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.