I am starter and I have question about the read() function of Servo library. Does the read function support read directly from the output signal of a RC receiver? For example, if I want to know what is the current output angle by the RC receiver, could I directly connect the signal output pin of RC receiver to the input pin of Arduino? Does the read function will measure the PWM pulse width from input pin or just return the current angle stored in the Servo object?
Read returns the last position written to the servo. ..so I guess NO
could I directly connect the signal output pin of RC receiver to the input pin of Arduino?
Yes
Does the read function will measure the PWM pulse width from input pin or just return the current angle stored in the Servo object?
Neither. It returns the value last sent to the servo using servo.write()
There are techniques for reading the input from an RC receiver such as the following
byte receiverPin = 7;
unsigned long duration;
void setup()
{
Serial.begin(115200);
pinMode(receiverPin, INPUT);
}
void loop()
{
duration = pulseIn(receiverPin, HIGH);
Serial.println(duration);
delay(100);
}
This program requires an RC Rx servo output pin to be connected to pin 7 of the Arduino and the RC Rx GND to be connected to the Arduino GND. The program does not print an angle, it prints the duration of the input pulse received which will vary as the RC Tx stick or switch is moved.