Go Down

Topic: +- tolerances from a signal (Read 1 time) previous topic - next topic


I'm running an RC tx/rx setup on my bot for motion until I get the speech rec polished for voice control. Hardware is a 3 channel RC unit (only using 2 channels though) being read by a Mega ADK board running a pair of brushed DC motors through an Adafruit Motor Shield. I've read as much as I can find online and am confident that this will work the way I want it to, mostly basing my code and setup on the tutorials from http://rcarduino.blogspot.com/2012/05/interfacing-rc-channels-to-l293d-motor.html.

I've calibrated my RC set as best I can. The 2 channels in use are throttle and turn with the following pulse values after calibration: Throttle: neutral = 1410, full ahead=1800, full brake/reverse = 1200. Turn: neutral=1400, full left = 1000, full right = 1800.

The problem: The above listed values are not solid, rather they all have a range somewhere between +- 10 and +- 20.

The question: How do I program that in? ie: For sitting at idle/stop, I am thinking I would program the equivalent of the following psuedocode:

Code: [Select]

ch1 = throttle position
read ch1
if ch1 = 1410
    some mapping of read value to - 255 to 255

But neutral is not always 1410. It ranges anywhere between 1400-1420 ish. Is it as simple as
if 1400<ch1<1420?

regards, Richard


Code: [Select]

if ((ch1 > 1400) && (ch1 < 1420)) {


Go Up