Pages: [1]   Go Down
Author Topic: Reading an RC Receiver  (Read 492 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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. smiley
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25755
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you're only interested in a single channel, then "pulseIn" might do the trick.
Search around the forum for PPM decode.
Logged

"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.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks AWOL, smiley
So something like this would work?

Code:
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);
}
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25755
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That looks like a good start - why not try it?
Logged

"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.

Pages: [1]   Go Up
Jump to: