This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Help with calculating cadence from a pulsing input

I am working on modifying the ant+ sdm example to hack my treadmill. Got the example running and talking to my Garmin watch and the display simulator. All of that seems straight forward and easy to manipulate.

Now I want to use one of the gp inputs to send the DK board an input signal that pulses once per rev of the drive roller of the treadmill.

I have looked at the bsp example as well as the bsp tutorial listed above. I think I can figure out how to use the bsp library and trigger events based off of the input (similar to a button press once per rev)

Using this input I will need to do some math to inject a cadence variable into the example sdm code and am looking for the way to pull that off.

I am thinking it will take something like storing the time at each pulse then subtract the previous reading from the most current reading and then divide 60(or whatever the time units are) by the result to get the cadence of pulses per minute.

I am a newbie at this code stuff so please be patient with me!

Related