Mar_56
Posts: 2
Joined: Tue Dec 20, 2016 4:58 pm

Timer Interruption

Tue Dec 20, 2016 5:07 pm

Hello,

I'm new on Raspberry. I wanted to know if it is possible to execute a code every 10 ms (for example) ? On an arduino board, I used timer interruption to do that with the following libray (#include <avr/interrupt.h), and use some prescaler etc.... I need that for servo motor control, or display some data (temperature, speed...) at a specific frequency.

If anyone have a very short example, and very simple, it would be good :)

For example, I want to display in the time in the console at every 100 ms. For now I used some delay in the main function, but it is not appropriate... because the code stop on the delay...

Thanks!

RichInTheUSA
Posts: 29
Joined: Fri Nov 04, 2016 1:27 am

Re: Timer Interruption

Tue Dec 20, 2016 7:31 pm

There are java tutorials on concurrency, with sleep timers. Sorry cant be more help... not sure what language you are coding in.

https://docs.oracle.com/javase/tutorial ... sleep.html

Mar_56
Posts: 2
Joined: Tue Dec 20, 2016 4:58 pm

Re: Timer Interruption

Tue Dec 20, 2016 9:11 pm

Thanks for the response :) For the language I prefer to used C programming...

Return to “Beginners”