I have a problem defining pitch and yaw for my quadcopter. Every time I set my PWM for my yaw to 1500, it's not affecting my yaw, but instead it's affecting my roll. I did not even do anything to my roll, and the PWM value of my roll is locked to 1500.
#include
#define pinA 10
#define pinB 11
#define THR_PIN 5
#define ROLL_PIN 0 //pin 1 receiver
#define PITCH_PIN 1 //pin 2 receiver
int pitch, roll, pitchpwm, rollpwm, error_x, last_error_x;
float pid;
int g_dt = 1;
float kp = 1.0;
float ki = 0.0;
float kd = 0.0;
String dataIn = "";
String data[3];
bool parsing;
Servo outpwm1;
Servo outpwm2;
int dataA;
int pwmA;
int pwmB;
int pwm_value = 0;
volatile int prev_time = 0;
volatile int roll_value = 0;
volatile int prev_time1 = 0;
volatile int pitch_value = 0;
volatile int prev_time2 = 0;
uint32_t count;
void setup() {
Serial.begin(115200);
Serial.println("connected!");
parsing = false;
init_remote();
Serial.print("MODE");
Serial.print(',');
Serial.print("PWM Pitch");
Serial.print(',');
Serial.print("PWM Roll");
Serial.print(',');
Serial.print("Koordinat y");
Serial.print(',');
Serial.print("Koordinat x");
Serial.print(',');
Serial.print("pitchpwm");
Serial.print(',');
Serial.println("nilai PID");
outpwm1.attach(pinA);
outpwm2.attach(pinB);
}
outpwm1.writeMicroseconds(pwmA);
outpwm2.writeMicroseconds(pwmB);
outpwm2.writeMicroseconds(pitch_value);
}
My goal is to control the value of my pitch and yaw. Can anyone tell me where I'm wrong? Thank you so much.