Servos won't react

I'm building a turret using arduino, and ran straight into a wall here, the servos won't react to the joystick input, and I'm trying to find out if it's a code issue.. its kind of a pressing matter, since the project is due in a short time period.
here's the code:

#include <Servo.h>

// lager variabler for servoer
Servo xservo; //xakse
Servo yservo;//yakse
Servo shootservo;//buttonpress, skyter

// Definerer pins, hvor de skal koble til arduino
const int XServoPin = 10;
const int YServoPin = 9;
const int ShootServoPin = 11;
const int XposPin = A0;
const int YposPin = A1;
const int buttonPin = A2;

// Definerer motorer (2, motore foran,de som dytter ut dart)
const int motorPin = 12;


// Definerer joystick variabler
int Xpos = 0; //standard posisjon for joystick, bÄde x og y (0)
int Ypos = 90; //"-"
int buttonPress; //standard press pÄ joystick (0)

// Definerer variabler for recoil (pause mellom skudd)
const byte recoil_rest = 180;
const byte recoil_pushed = 125;
unsigned recoil_start_time = 0;
unsigned recoil_time = 300;


void setup() {
  pinMode(buttonPin, INPUT); //Setter "buttonPin" som INPUT
  digitalWrite(buttonPin, HIGH); //aktiverer arduino "pullup" for "buttonPin"

//fester servoer til pins. 
  xservo.attach(XServoPin);
  yservo.attach(YServoPin);
  shootservo.attach(ShootServoPin);

//Definerer "motorPin" som en output
  pinMode(motorPin, OUTPUT);

  Serial.begin(9600);

//slÄ pÄ motorer
  digitalWrite(motorPin, HIGH);
}

void loop() {

  //lag buttonpress, altsÄ en lesing av buttonPin (nÄr joysticken presses)
  buttonPress = digitalRead(buttonPin);
  
  if (buttonPress == 0) { // blir presset    (skal 0 vĂŠre 1?)
    // SlÄ pÄ servo, dytt dart ut
    shootservo.write(recoil_pushed);
    delay(recoil_time); // veeeeent
    shootservo.write(recoil_rest); // tilbake til 'rest' posisjon
  }

//Konverterer x og y verdier fra joysticken til posisjon pÄ servo, med verdier fra 0, 1023, 0, 180. rest posisjon er 86, denne leser av verdier mellom 86 og 180, og legger til + verdi for jo hÞyere verdi tallet har over 86.
  int joyXValue = analogRead(XposPin);
  int joyYValue = analogRead(YposPin);

  int MapXpos = map(joyXValue, 0, 1023, 0, 180);
  int MapYpos = map(joyYValue, 0, 1023, 0, 180);

  if (MapXpos > 86 && Xpos<180){
    ++Xpos;
  }
  else if (MapXpos < 86 && Xpos>0){
      --Xpos;
  }
  
//Samme som x posisjoner, bare med y posisjon, med "rest" verdi 91. bÄde + og -       
  if (MapXpos > 91 && Xpos<180){
    ++Xpos;
  }
  else if (MapXpos < 91 && Xpos>0){
      --Xpos;
  }
  


  xservo.write(Xpos); //leser av verdiene, flytter x servo til der x er pÄ joystick
  yservo.write(Ypos); //lerer av verdiene, flytter y serco til der y er pÄ joystick

 // gjÞr det mulig Ä printe ut verdier i seriell overvÄker. 
  Serial.println(buttonPress); //I seriell overvÄker, vises i 0 og 1. 0=LOW/ikke presset 1=HIGH/presset
  Serial.println(MapXpos);//bÄde x og y vises med koordinatverdier. 
  Serial.println(MapYpos);
}

You already have a thread about this project

you should post there so that there is context

right, sorry!

did you give up on bluetooth ?
do you have enough power for the motors? (not through the arduino, right?)

yeah, every group did, no one got it to work, and with a dangerously approaching deadline, continuing with bluetooth wasnt worth it

also used a 9v battery, the motors in front started running, the servos wont.

OK - I think you had bad modules. Since the other post relates more to the remote control, let's keep this discussion here

did you try a simple sweep code to see if the circuit is OK?

I'll try that!

try something like this

#include <Servo.h>

// lager variabler for servoer
Servo xservo; //xakse
Servo yservo;//yakse
Servo shootservo;//buttonpress, skyter

// Definerer pins, hvor de skal koble til arduino
const byte XServoPin = 10;
const byte YServoPin = 9;
const byte ShootServoPin = 11;
const byte XposPin = A0;
const byte YposPin = A1;
const byte buttonPin = A2;

// Definerer motorer (2, motore foran,de som dytter ut dart)
const int motorPin = 12;

// Definerer variabler for recoil (pause mellom skudd)
const byte recoil_rest = 180;
const byte recoil_pushed = 125;
unsigned recoil_start_time = 0;
unsigned recoil_time = 300;


void setup() {
  pinMode(buttonPin, INPUT_PULLUP); //aktiverer arduino "pullup" for "buttonPin"
  pinMode(motorPin, OUTPUT);  //Definerer "motorPin" som en output

  Serial.begin(115200);

  //fester servoer til pins.
  xservo.attach(XServoPin);
  yservo.attach(YServoPin);
  shootservo.attach(ShootServoPin);
  digitalWrite(motorPin, HIGH); //slÄ pÄ motorer
}

void loop() {

  //lag buttonpress, altsÄ en lesing av buttonPin (nÄr joysticken presses)
  if (digitalRead(buttonPin) == LOW) { // "LOW" betyder tryckt eftersom pinnen Àr instÀlld som INPUT_PULLUP.
    shootservo.write(recoil_pushed);
    delay(recoil_time);             // veeeeent
    shootservo.write(recoil_rest);  // tilbake til 'rest' posisjon
  }

  //Konverterer x og y verdier fra joysticken til posisjon pÄ servo, med verdier fra 0, 1023, 0, 180. rest posisjon er 86, denne leser av verdier mellom 86 og 180, og legger til + verdi for jo hÞyere verdi tallet har over 86.
  int MapXpos = map(analogRead(XposPin), 0, 1023, 0, 180);
  int MapYpos = map(analogRead(YposPin), 0, 1023, 0, 180);

  xservo.write(MapXpos); //leser av verdiene, flytter x servo til der x er pÄ joystick
  yservo.write(MapYpos); //lerer av verdiene, flytter y serco til der y er pÄ joystick
  delay(10);
}

the servos should move directly based on the position of the joystick - it's not incremental so movement can be harsh

do you think the sweep code will work without having to pull the whole construction apart?

yes no need to remove anything. that's actually the point verifying that your circuit is OK (as the code is OK)

if you use this

#include <Servo.h>

Servo myservo; 
int pos = 0;

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}

and your Y servo should sweep

if you change the attached pin to 10

  myservo.attach(10);  // attaches the servo on pin 9 to the servo object

then you should see the X servo sweep

and if you change it to 11, that would be the Shoot Servo

if the servos don't move, you have a circuit issue. Possibly on the power side.

ok, so the sweep doesnt work, thats a circuit issue?

Is there a ground connection between the servos and the Nano.
I don't see one on your wiring diagram

I don't think so, no

is this scheme still what you have?

pretty much, just with a joystick in place of the bluetooth module.

what's the power supply connected to the jack?
do you still have a voltage adapter ?

best would be to post a new schematic

9v battery

the typical 9V batteries are not suitable for multiple motors. They don't provide enough current.

what would you suggest?

use 4 or 6 AA batteries in series to get the right voltage for example