How to set function update period

More
10 years 6 months ago #72906 by Eric282000
This is from the hal componet documentation.

function NAME. The function includes a parameter period which is the integer number of nanoseconds between calls to the function.


How would I use the period parameter to make the function only update once per second?

I would like to run the component under the servo - thread but have one of the functions called one per second.

Thanks

Please Log in to join the conversation.

More
10 years 6 months ago #72908 by andypugh
accum += period
if accum >= 1000000000 {
accum = 0
do_stuff
}

Please Log in to join the conversation.

Time to create page: 0.071 seconds
Powered by Kunena Forum