Reading a PWM

I am trying to get a signal from a RC transmitter and receiver into an Arduino. I am trying to make a speed controller with the Arduino.

I got the receiver connected to the Arudino digital Input and I can see the PWM on an oscilloscope that the reciever outputs. When I move one of the transmitter's joystick up and down I can see the PWM for that axis grow and shrink between 1.0 and 2 ms width with a constant 20ms frequency. Does anyone have any example code on how to read a PWM reciever where the time width correlates to the position of the transmitter joystick position of an axis?

thanks in advance.

won

Hi

I have an easier solution for this perhaps...

Take an R/C servo, and replace the motor with a 1K resistor. Connect it to the RC receiver. Moving the RC transmitter produces +/- 3V or so if I remember correctly. Now make a bridge rectifier out of 1N914/1N4148 diodes and put it across the resistor that you replaced the motor with.

The range of the transmitter will now be represented as 0-3V across the output of the bridge rect., and can be read by the Analog pin, without the software overhead that you would have with PWM decoding.

You might also want to just try half-wave rectifying the receiver output to see what you get!

D