Help with code

hey guys. i am very new to arduino and i am making a quadcopter, i have a lot of issues with programming and my quad wont fly :frowning: can anyone just help me out with the code that i should use. ill give you the details about my quad. all i want is to hover my quad for the time being.this will be your utmost kindness if you can simply provide me with the code
i am using :
arduino uno,
GY-80,
1000KV MOTORS,
30 A ESC,
5000mah ,3s ,11.1V battery
6ch transmitter receiver.

this is the program that i had written(apologies for the silly mistakes):

#include<Servo.h>
Servo motor1;
Servo motor2;
Servo motor3;
Servo motor4;
int chPin1 = 6, chPin2 = 7, chPin3 = 8, chPin4, chPin5 = 12, chPin6;
int ch11, ch33;
int throttle;
void setup() {
  pinMode(chPin1, INPUT);
  pinMode(chPin3, INPUT);
  pinMode(chPin5, INPUT);
  pinMode(chPin2, INPUT);
  motor1.attach(A1);
  motor3.attach(A3);
  motor2.attach(A2);
  motor4.attach(A0);
}

void loop() {
  chPin3 = pulseIn(chPin3, HIGH, 50000);
  chPin1 = pulseIn(chPin1, HIGH, 50000);
  ch33 = map(ch33, 1000, 2000, -50, 50);
  ch11 = map(ch11, 1000, 2000, -50, 50);
  throttle = pulseIn(chPin2, HIGH, 50000);

  if (digitalRead(chPin5) == 1) {
    motor1.writeMicroseconds(throttle + ch33 - ch11);
    motor3.writeMicroseconds(throttle + ch33 + ch11);
    motor2.writeMicroseconds(throttle - ch33 - ch11);
    motor4.writeMicroseconds(throttle - ch33 + ch11);
  }
  else {
    motor1.writeMicroseconds(1000);
    motor2.writeMicroseconds(1000);
    motor3.writeMicroseconds(1000);
    motor4.writeMicroseconds(1000);
  }
}

More meaningful variable names would help plus some comments indicating what you're expecting to read on chPin1, chPin2 etc.

But just from a quick look -
chPin3 = pulseIn(chPin3, HIGH, 50000);
chPin1 = pulseIn(chPin1, HIGH, 50000);

I'm pretty sure you don't mean this. You're trying to set your input pin numbers to values obtained by reading the same input pins.

Then you're trying to use variables called ch33 and ch11 which you never set to any values.

Steve

big project, start small and build up to big.

worry about controlling one motor, get it to do what you exactly want. then add another using the same methods.

if when you add another motor you may find the first way you tried wont work with multiple motors, so you will have to change the way you do it.

start again with a different method and one motor, then another.

i can promise you, you wont get it the first time. but thats what makes this interesting, keep trying