PaulStoffregen / FreqCount

Measures the frequency of a signal by counting the number of pulses during a fixed time.
http://www.pjrc.com/teensy/td_libs_FreqCount.html
145 stars 48 forks source link

Duty Cycle #33

Open AntonioFromBrazil opened 1 year ago

AntonioFromBrazil commented 1 year ago

Is there anyway to read the duty cycle in addition to the frequency value ? Thanks

antst commented 1 year ago

Yep, that would be nice addition :) I was trying to sort out through the code, how to add. But I am not good enough to quickly grasp how to add second interrupt on second edge, so we have interrupts on both, rising and falling, edges. In principal, if we quick with reading, we can set interrupt on change (can we?), which covers both edges, and add reading state of the pin, to know on which edge we are. Or, maybe, use two pins, one for rising edge, another of falling.

antst commented 1 year ago

I checked, in FreqMeasure, there is already functionality for rising/falling edges. Will try to wrap my head around )