Go Down

Topic: Reading an RC Receiver (Read 524 times) previous topic - next topic

MDRobbo

Hi Ive been reading through the forums and looking for a library which I can use to read the output of an rc receiver. All the code in the forums are based on using a composite ppm output. Any help would be greatly appreciated.

Cheers,
MDRobbo. :)

MDRobbo

Sorry one more thing to add, I would like to be able to read an idividual channel.

AWOL

If you're only interested in a single channel, then "pulseIn" might do the trick.
Search around the forum for PPM decode.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

MDRobbo

Thanks AWOL, :)
So something like this would work?

Code: [Select]
unsigned long pulseWidth = 0;
void setup()
{
  Serial.begin(57600);
  pinMode(8, INPUT);
 
}

void loop()
{
  pulseWidth = pulseIn(8, HIGH);
  Serial.println(convert(pulseWidth), DEC);
 
}

long convert(long pulseWidth)
{
  int value = pulseWidth - 1000;
  return constrain(map(value / 5, 0, 200, 0, 180), 0, 180);
}

AWOL

That looks like a good start - why not try it?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up