Pages: 1 [2]   Go Down
Author Topic: Rc Receiver to a variable  (Read 1069 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 240
Posts: 24433
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No, simply pass the output of pulse in into map.
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.

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 551
Posts: 46215
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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?
Logged

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

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

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No, simply pass the output of pulse in into map.
Would you mind giving some example code?
Logged

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

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.
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 [2]   Go Up
Jump to: