Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

How do I read an RC Receiver value


I am just getting started using the Orangutan Jr and one of the things I need to do is read the RC receiver to see that I have a valid “HIGH” before my robot can be enabled. How do I use the Input Capture to do this and is it the best method? Is there some sample code someone can send me?



I haven’t really used the input capture feature on the mega168, but the mega168 datasheet could probably help you figure out what it can do and how to use it. I typically use pin change interrupts to capture RC signal pulses. You can find an example of using pin change interrupts in this thread (the top post on the second page, written by me):

Whenever a pin change event occurs, I would set a variable equal to the current count of a running timer. If you’re careful about timer overflows, you can use this technique to figure out how much time has elapsed between pin changes, and you can in turn use this to figure out how long the signal spends high and how long it spends low.

- Ben

Cheat sheet

Thanks, I will give it a try. I like the simplicity of it.