I have a project where I want to have signals from my rc plane's flight controller go into my arduino and then be outputted by the arduino so the plane functions normally and I can see what signals are being sent. I connected all the servos to the arduino and they are working as intended, but when I tried to do the same with my esc for the propellor, the signals are not being received properly. For all of the servos, I receive a PWM signal that changes as I change the input on the plan'es controller, but for the motor esc, I receive some sort of PWM signal, but it does not change as I change the throttle on the plane's controller. Once I switch the signal wire from Flight Controller>Arduino and make it Flight Controller>esc the propellor works as intended.
I have tried to output signals from the arduino to control the esc independent of the flight controller, but I still can't get any response on the motor.
My question is what might be causing the signal for the esc to not be received by the arduino and why doesn't it work when I give it PWM inputs, whereas the servo signals are received by the arduino and respond to PWM inputs.
/*
Written By Aaron James
*/
#include <Servo.h>
unsigned long Rudder;
unsigned long Elevator;
unsigned long Right;
unsigned long Left;
unsigned long Engine;
Servo Rudder_servo;
Servo Elevator_servo;
Servo Right_servo;
Servo Left_servo;
Servo Engine_servo;
void setup() {
// put your setup code here, to run once:
//PWM pins are 3,5,6,9,10 and 11 for the NANO
//Network Address for lora transmitter and recievers [3]
//Inputs should be on pins 2 4 7 8 12
//Output should be on pins 3 5 6 9 10
//11 is a spare pin for either output/input
Serial.begin(9600);
Rudder_servo.attach(3);
Elevator_servo.attach(5);
Right_servo.attach(6);
Left_servo.attach(9);
Engine_servo.attach(10);
pinMode (2, INPUT); //Rudder Input
pinMode (4, INPUT); //Elevator Input
pinMode (7, INPUT); //Aileron Right Input
pinMode (8, INPUT); //Aileron Left Input
pinMode (12, INPUT); //Engine Input
pinMode (3, OUTPUT); //Rudder Output
pinMode (5, OUTPUT); //Elevator Output
pinMode (6, OUTPUT); //Aileron Right Output
pinMode (9, OUTPUT); //Aileron Left Output
pinMode (10, OUTPUT); //Engine Output
}
void loop() {
// put your main code here, to run repeatedly:
Rudder=pulseIn(2, HIGH);
Rudder_servo.writeMicroseconds(Rudder);
//Serial.println(Rudder);
Elevator=pulseIn(4, HIGH);
Elevator_servo.writeMicroseconds(Elevator);
//Serial.println(Elevator);
Right=pulseIn(7, HIGH);
Right_servo.writeMicroseconds(Right);
//Serial.println(Right);
Left=pulseIn(8, HIGH);
Left_servo.writeMicroseconds(Left);
//Serial.println(Left);
Engine=pulseIn(12, HIGH);
Engine_servo.writeMicroseconds(Engine);
Serial.println(Engine);
}