my goal is to read a pwm signal from a rc receiver. For that i tried to use an arduino.
i ran this code on the arduino:
#define Pin 3
int pwm_value;
void setup() {
pinMode(Pin, INPUT);
Serial.begin(9700);
}
void loop() {
pwm_value = pulseIn(Pin, HIGH);
Serial.println(pwm_value);
}
Now i connected the 3rd pin with the output of the receiver. But instead of printing the correct pwm values they get printed completely crazy. Sometimes they are under 10 and sometimes they are over 10000. The receiver outputs the correct signal.
I also noticed that if i just touch the pin with my finger or if i only connect a single jumper cable without anything at the end, the arduino will read a pwm signal.
I have realy no idea to solve that. Can you please help me?
Thank you!
pinMode(pin, INPUT_PULLUP);