Rc Receiver to a variable

Ok so me and my school club are working with arduino and are planning to make various things, and we were thinking we could use an RC controller to control our projects, (and make things pretty universal). Ive been sent on the mission to hook this up to arduino, to be used. I've looked everywhere and cant really find what im looking for (Im a beginner with codeing, but learning). I thought i would ask the community of Arduino its self.. So my thinking is that have the Rc reciver be read by the arduino and then create a variable (between 0-180, that would make sense right? since its originally controlling servos) and then for whatever we need it for I can set variables to do things (easily with if statements)

I would very much appreciate anyone's time to code this.

If any questions just post and id be happy to answer. (Oh also we are using Arduino UNO, if you need to know that)

-MrBuggitt

Read a pulse's length Map a number to a different range

AWOL: Read a pulse's length Map a number to a different range

Does pulsein work with PWM?

Does pulsein work with PWM?

For what purpose?

Does pulsein work with PWM?

The great thing about Arduino is, it allows you to try things out, very rapidly. But another answer is "it depends on the frequency of the PWM"

PaulS:

Does pulsein work with PWM?

For what purpose?

Read the OP, I would like to take the PWM input (to arduino) and translate it to a variable so I can easily use my RC transmitter/receiver.

Yes, you can do that. You can read the PWM out of one of the Arduino's pins

Hi,

have a look here, there is a lot about reading RC receivers, the whole site is bought RC and arduino.

Rcarduino.blogspot.com

Duane b rcarduino.blogspot.com

Read the OP, I would like to take the PWM input (to arduino) and translate it to a variable so I can easily use my RC transmitter/receiver.

I read the OP. The output of an RC transmitter is NOT PWM. Get over it.

PaulS:

Read the OP, I would like to take the PWM input (to arduino) and translate it to a variable so I can easily use my RC transmitter/receiver.

I read the OP. The output of an RC transmitter is NOT PWM. Get over it.

I though it would be. Since its original use it controlling a servo (which is pwm)

Since its original use it controlling a servo (which is pwm)

No, servos do NOT use PWM. Where did you get that idea?

Actually, they do use PWM. The stream between Tx and Rx is PPM, but once the stream is past the demultiplexer and on its way to the servo or ESC, it's PWM. Get over it. I did.

AWOL: Actually, they do use PWM. The stream between Tx and Rx is PPM, but once the stream is past the demultiplexer and on its way to the servo or ESC, it's PWM. Get over it. I did.

Thank you, So is there an easy way to 'read' the pwm to a 0-180 variable?

See reply #1

AWOL: See reply #1

Would it be anything like the potentiometer example sketch?

No, simply pass the output of pulse in into map.

The stream between Tx and Rx is PPM, but once the stream is past the demultiplexer and on its way to the servo or ESC, it's PWM. Get over it. I did.

Then, how is it that servos can be connected to other than PWM pins, and still operate. The Servo library is not doing soft-PWM, is it?

Just because the Servo library doesn't do 490Hz 0-100% PWM doesn't make it any less PWM. The position of the servo or speed of the ESC (which may itself output a different frequency and duty cycle PWM) is proportional to the width of the pulse, hence Pulse Width Modulation.

AWOL: No, simply pass the output of pulse in into map.

Would you mind giving some example code?

int servoAngle = map ( pulseIn (rxPin, HIGH), 540, 2400, 0, 180);

Of course, you may have to play with the constants. Even do some preprocessing, but, as I said, that's the gist.