How to set function update period

More
07 Apr 2016 12:40 #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 or Create an account to join the conversation.

More
07 Apr 2016 12:43 #72908 by andypugh
accum += period
if accum >= 1000000000 {
accum = 0
do_stuff
}
The following user(s) said Thank You: Eric282000

Please Log in or Create an account to join the conversation.

Time to create page: 0.060 seconds
Powered by Kunena Forum