-1

I tried to read a PWM signal from Pixhawk by connecting it to Arduino. The Pixhawk is connected to FrSky X8R. But my PWM always reads to zero.

Here's my arduino code

#define RCPin 4
int RCValue;


void setup() {
  Serial.begin(9600);
  pinMode(RCPin, INPUT);
}

void loop() {
  RCValue = pulseIn(RCPin, HIGH,25000);
  Serial.println(RCValue);
}

The picture attached is also my wiring.

enter image description here

  • Can't see too much wrong with the code. Are you definitely getting a pwm signal from the pixhawk? Do you have a servo you could connect it to? Have you tried reading from one of the frsky pwm channels to test the code? – cguk70 Jun 09 '22 at 20:06

1 Answers1

1

First of all pin 4 isn't a PWM pin. As i can see you're using Arduino UNO. In UNO PWM pins are: 3, 5, 6, 9, 10, 11 And their Frequencies: 490 Hz except pin 5 and pin 6, their frequencies is: 980 Hz.

So, change your pin as 5 and it will work then.

Halil Sahin
  • 568
  • 1
  • 6
  • 25