What I'd like to do is to create an interrupt one a timer expires after 1 ms ... 100 ms. It doesn't even have to be very accurate.

Working with microcontrollers I'm used to start a timer say in main() and get an interrupt when it expires.

But how do I set this up with the Raspberry Pi? I'm using WiringPi but so far I haven't found how to do this.

I'd be happy to get some insights on this. Thank you very much.


1 Answer 1


The wiringPi library provides a number of blocking timer calls. One is used for micro second granularity (delayMicroseconds) and the other is used for milli second granularity (delay). See:


Using either of these, you can block your C program for a configurable amount of time. For example, if you need to send a pulse every 50 milli seconds, you could code:

   // Code to send a pulse

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.