Is there any way I can count pulses when the switch opens instead of switch closure?
Generally, every time a switch opens it will also close later. Each pulse will have both. So, in many cases you don't have to worry.
A pulse will do either of the below scenarios depending on how the circuit is wired:
High -- Low -- High (switch close usually)
Low -- High -- Low (high frequency usually)
Pulse counting hardware is either counting the change from high to low or the change from low to high. This is only an issue if the pulse stays in the middle state for a long time, and you want to count the beginning.
Give the high frequency option in pulse count a try on your system.
For a definitive answer, I need to know which datalogger model and channel type you are using.
I'm using a normally open SPST switch to detect opening of a window
If you are looking for the state of the window (open or closed) then the pulse count is probably not the best solution. You could use the datalogger 5V signal into the SPST switch and connect that to a C terminal to check the state of the window. Use the ReadIO instruction to etermine the state. Or you could use a Vx singal into the SPST switch and connect that to a single ended analog channel and simply compare the voltage to a level that would determine the state.
Hi, I am trying to count pulses from a flow meter when irrigation is running. I connected the meter to P1 on a CR1000X. From a multimeter reading, the voltage at P1 is normally high at 4.9V, and drops when the switch closes. However nothing is being registered from my pulseCount() function. The function is in a loop that scans every 10 seconds - could it just be missing the switch closure?