Digital input pin - measuring frequency?

Started by Lukapple, January 30, 2020, 04:32:29 PM

Lukapple

Hi,
can anyone recommend a simple lightweight library for measuring frequency of digital input pin signal?

I want to do a simple garage door status detector. Garage door opener has a contact, which is:
- open when door is closed,
- 0.5s open and 0.5s closed (repeating signal) when door is closing,
- 1s open and 1s closed (repeating signal) when door is opening and
- closed contact when door is open

I connected that contact to Moteino (Digital pin and GND pin) and now I want to detect the state of the door.

TomWS

There is an Arduino library called FreqCounter that I've used for moisture sensors, but I think the sensing frequency range is higher than what you're looking for.  You might be able to create a couple of Bounce2 objects (using Bounce2 library), using the same pin as the input, but different bounce characteristics to filter out each type of signal.

Lukapple

Thanks for the suggestion Tom. I'll try with to solve that problem with Bounce lib.