Fehlermeldung komm nicht Drauf!

bekomme diese Fehlermeldung und ich komm nicht drauf was da falsch is
könnte jemand helfen Danke.

Arduino: 1.8.16 (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"
C:\Users\Boss\Documents\Arduino\sketch_nov16e\sketch_nov16e.ino: In function 'void loop()':
sketch_nov16e:148:1: error: expected '}' at end of input
}
^
sketch_nov16e:148:1: error: expected '}' at end of input
sketch_nov16e:148:1: error: expected '}' at end of input
sketch_nov16e:148:1: error: expected '}' at end of input
exit status 1
expected '}' at end of input

#include "HCPCA9685.h"
#define I2CAdd 0x40 
#define JoyX A0 // 
#define JoyY A1 // 
#define JoySwitch A2



int Servo1Position;
int Servo5Position;
int Servo9Position;
int Servo13Position;
int Servo0Position;
int Servo4Position;
int Servo8Position;
int Servo12Position;
HCPCA9685 HCPCA9685(I2CAdd); 



void setup()
{
  HCPCA9685.Init(SERVO_MODE); 
  HCPCA9685.Sleep(false); 
 
  Servo1Position = 210;
  Servo5Position = 210;
  Servo9Position = 230;
  Servo13Position = 210;
  Servo0Position = 220;
  Servo4Position = 200;
  Servo8Position = 190;
  Servo12Position = 210;


 
  HCPCA9685.Servo(1, Servo1Position);
  HCPCA9685.Servo(5, Servo5Position); 
  HCPCA9685.Servo(9, Servo9Position);
  HCPCA9685.Servo(13, Servo13Position);
  HCPCA9685.Servo(0, Servo0Position);
  HCPCA9685.Servo(4, Servo4Position); 
  HCPCA9685.Servo(8, Servo8Position);
  HCPCA9685.Servo(12, Servo12Position); 
  pinMode(JoySwitch, INPUT_PULLUP);
}


void loop()
{
  if (!digitalRead(JoySwitch)) { 
    delay(500);
    
    Servo1Position = 210;
    Servo5Position = 210;
    Servo9Position = 230;
    Servo13Position = 210;
    Servo0Position = 220;
    Servo4Position = 200;
    Servo8Position = 190;
    Servo12Position = 210;
   
    HCPCA9685.Servo(1, Servo1Position); 
    HCPCA9685.Servo(5, Servo5Position); 
    HCPCA9685.Servo(9, Servo9Position); 
    HCPCA9685.Servo(13, Servo13Position); 
    HCPCA9685.Servo(0, Servo0Position); 
    HCPCA9685.Servo(4, Servo4Position); 
    HCPCA9685.Servo(8, Servo8Position); 
    HCPCA9685.Servo(12, Servo12Position);
  }
  
  if (analogRead(JoyX) > 800) {
    if (Servo1Position < 420) {
      Servo1Position++;
    }
    if (analogRead(JoyY) > 800) {
      if (Servo0Position < 420) { 
        Servo0Position++;
      }
      if (Servo13Position > 10) {
        Servo13Position--;
        if (Servo12Position > 10) { 
          Servo12Position--;variable by 1
        }
        delay(1);
        HCPCA9685.Servo(1, Servo1Position);
        HCPCA9685.Servo(13, Servo13Position);
        HCPCA9685.Servo(0, Servo0Position);
        HCPCA9685.Servo(12, Servo12Position); 
      }
      if (analogRead(JoyX) < 300) {
        if (Servo1Position > 10) {
          Servo1Position--;
        }
        if (analogRead(JoyY) < 300) {
          if (Servo0Position > 10) {
            Servo0Position--;
          }
          if (Servo13Position < 420) {
            Servo13Position++;
          }
          if (Servo12Position < 420) {
            Servo12Position++;
          }
          delay(1);
          HCPCA9685.Servo(1, Servo1Position);
          HCPCA9685.Servo(13, Servo13Position);
          HCPCA9685.Servo(0, Servo0Position);
          HCPCA9685.Servo(12, Servo12Position);
        }
        
        if (analogRead(JoyX) > 800) {
          if (Servo5Position < 420) {
            Servo5Position++;
          }
          if (analogRead(JoyY) > 800)
            if (Servo4Position < 420) {
              Servo4Position++;
            }
          if (Servo9Position > 10) {
            Servo9Position--;
            if (Servo8Position > 10) {
              Servo8Position--;
            }
            delay(1);
            HCPCA9685.Servo(5, Servo5Position);
            HCPCA9685.Servo(9, Servo9Position); 
            HCPCA9685.Servo(4, Servo4Position); 
            HCPCA9685.Servo(8, Servo8Position); 
          }
          if (analogRead(JoyX) < 300) {
            if (Servo5Position > 10)
              Servo5Position--;
          }
          if (analogRead(JoyY) < 300) {
            if (Servo4Position > 10)
              Servo4Position--;
          }
          if (Servo9Position < 420) {
            Servo9Position++;
            if (Servo8Position < 420) {
              Servo8Position++;
            }
            delay(1);
            HCPCA9685.Servo(5, Servo5Position); 
            HCPCA9685.Servo(9, Servo9Position); 
            HCPCA9685.Servo(4, Servo4Position);
            HCPCA9685.Servo(8, Servo8Position);
          }
        }
      }

Formatiere den Sketch erst mal richtig. Dann fällt es eher auf wo die Klammer fehlt

Und zum Posten von Code entsprechende Tags verwenden, d.h. den < /> Knopf drücken

Sorry Anfänger
neu geladen
Danke

  if (analogRead(JoyX) > 800) {
    if (Servo1Position < 420) { // Check if maximum movement of Servo reacheServo0Position++;
      Servo1Position++;
    }
    if (analogRead(JoyY) > 800) {
      if (Servo0Position < 420) { // Check if maximum movement of Servo reacheServo0Position++;
        Servo0Position++;
      }

Ist das tatsächlich so gewollt?
Ich glaube, Du hast Dich mit den if's vertan, die liegen alle unterhallb der vorigen Ebene.
Da fehlt für jede Ebene die schliessende Klammer.

Das is der Code für die für die Y Achse
jetzt habe ich versucht die X Achse mit den Anderen Servos einzugügen siehe oben mit der Fehlermeldung.

#include "HCPCA9685.h"
#define I2CAdd 0x40
#define JoyX A0
#define JoyY A1
#define JoySwitch A2



int Servo0Position;
int Servo4Position;
int Servo8Position;
int Servo12Position;
HCPCA9685 HCPCA9685(I2CAdd);


void setup()
{
  HCPCA9685.Init(SERVO_MODE);
  HCPCA9685.Sleep(false);

  Servo0Position = 220;
  Servo4Position = 200;
  Servo8Position = 190;
  Servo12Position = 210;



  HCPCA9685.Servo(0, Servo0Position);
  HCPCA9685.Servo(4, Servo4Position);
  HCPCA9685.Servo(8, Servo8Position);
  HCPCA9685.Servo(12, Servo12Position);
  pinMode(JoySwitch, INPUT_PULLUP);
}


void loop()
{
  if (!digitalRead(JoySwitch)) {
    delay(500);

    Servo0Position = 220;
    Servo4Position = 200;
    Servo8Position = 190;
    Servo12Position = 210;

    HCPCA9685.Servo(0, Servo0Position);
    HCPCA9685.Servo(4, Servo4Position);
    HCPCA9685.Servo(8, Servo8Position);
    HCPCA9685.Servo(12, Servo12Position);
  }

  if (analogRead(JoyY) > 800) {
    if (Servo0Position < 420) {
      Servo0Position++;
    }
    if (Servo12Position > 10) {
      Servo12Position--;
    }
    delay(1);
    HCPCA9685.Servo(0, Servo0Position);
    HCPCA9685.Servo(12, Servo12Position);
  }
  if (analogRead(JoyY) < 300) {
    if (Servo0Position > 10) {
      Servo0Position--;
    }
    if (Servo12Position < 420) {
      Servo12Position++;
    }
    delay(1);
    HCPCA9685.Servo(0, Servo0Position);
    HCPCA9685.Servo(12, Servo12Position);
  }

  if (analogRead(JoyY) > 800) {
    if (Servo4Position < 420) {
      Servo4Position++;
    }
    if (Servo8Position > 10) {
      Servo8Position--;
    }
    delay(1);
    HCPCA9685.Servo(4, Servo4Position);
    HCPCA9685.Servo(8, Servo8Position);
  }
  if (analogRead(JoyY) < 300) {
    if (Servo4Position > 10) {
      Servo4Position--;
    }
    if (Servo8Position < 420) {
      Servo8Position++;
    }
    delay(1);
    HCPCA9685.Servo(4, Servo4Position);
    HCPCA9685.Servo(8, Servo8Position);
  }
}

kannst Du mal probieren, ob der Code das selbe für Y macht?

#include "HCPCA9685.h"
#define I2CAdd 0x40
#define JoyX A0
#define JoyY A1
#define JoySwitch A2



int Servo0Position;
int Servo4Position;
int Servo8Position;
int Servo12Position;
HCPCA9685 HCPCA9685(I2CAdd);


void setup()
{
  HCPCA9685.Init(SERVO_MODE);
  HCPCA9685.Sleep(false);
  Servo0Position = 220;
  Servo4Position = 200;
  Servo8Position = 190;
  Servo12Position = 210;
  HCPCA9685.Servo(0, Servo0Position);
  HCPCA9685.Servo(4, Servo4Position);
  HCPCA9685.Servo(8, Servo8Position);
  HCPCA9685.Servo(12, Servo12Position);
  pinMode(JoySwitch, INPUT_PULLUP);
}


void loop()
{
  if (!digitalRead(JoySwitch))
  {
    delay(500);
    Servo0Position = 220;
    Servo4Position = 200;
    Servo8Position = 190;
    Servo12Position = 210;
  }
  if (analogRead(JoyY) > 800)
  {
    if (Servo0Position < 420)
    {
      Servo0Position++;
      Servo4Position++;
    }
    if (Servo12Position > 10)
    {
      Servo8Position--;
      Servo12Position--;
    }
    delay(1);
  }
  if (analogRead(JoyY) < 300)
  {
    if (Servo0Position > 10)
    {
      Servo0Position--;
      Servo4Position--;
    }
    if (Servo12Position < 420)
    {
      Servo8Position++;
      Servo12Position++;
    }
    delay(1);
  }
  HCPCA9685.Servo(0, Servo0Position);
  HCPCA9685.Servo(12, Servo12Position);
  HCPCA9685.Servo(4, Servo4Position);
  HCPCA9685.Servo(8, Servo8Position);
}

OK ich teste mal

Zwischenfrage: Das ist die verwendete lib?

hab mich vorhin verlesen ggg

Ja das macht er jetzt mit der Y achse aber wie bekomm ich das jetzt hin das ich die X achse mit den anderen servos.
Dake nochmal

Da Du meine Frage nicht beantwortest, kommt es blind.

#include "HCPCA9685.h"
#define I2CAdd 0x40
#define JoyX A0 // 
#define JoyY A1 // 
#define JoySwitch A2



int Servo1Position;
int Servo5Position;
int Servo9Position;
int Servo13Position;
int Servo0Position;
int Servo4Position;
int Servo8Position;
int Servo12Position;
HCPCA9685 HCPCA9685(I2CAdd);



void setup()
{
  HCPCA9685.Init(SERVO_MODE);
  HCPCA9685.Sleep(false);
  initServo();
  pinMode(JoySwitch, INPUT_PULLUP);
}



void xAxis()
{
  if (analogRead(JoyX) < 300)
  {
    if (Servo5Position > 10)
    {
      Servo5Position--;
    }
    if (Servo1Position > 10)
    {
      Servo1Position--;
    }
  }
  if (analogRead(JoyX) > 800)
  {
    if (Servo1Position < 420)
    {
      Servo1Position++;
    }
    if (Servo5Position < 420)
    {
      Servo5Position++;
    }
  }
}

void yAxis()
{
  if (analogRead(JoyY) < 300)
  {
    if (Servo0Position > 10)
    {
      Servo0Position--;
    }
    if (Servo13Position < 420)
    {
      Servo13Position++;
    }
    if (Servo12Position < 420)
    {
      Servo12Position++;
    }
    if (Servo4Position > 10)
    {
      Servo4Position--;
    }
    if (Servo9Position < 420)
    {
      Servo9Position++;
    }
    if (Servo8Position < 420)
    {
      Servo8Position++;
    }
  }
  if (analogRead(JoyY) > 800)
  {
    if (Servo4Position < 420)
    {
      Servo4Position++;
    }
    if (Servo9Position > 10)
    {
      Servo9Position--;
    }
    if (Servo8Position > 10)
    {
      Servo8Position--;
    }
    if (Servo0Position < 420)
    {
      Servo0Position++;
    }
    if (Servo13Position > 10)
    {
      Servo13Position--;
    }
    if (Servo12Position > 10)
    {
      Servo12Position--;
    }
  }
}

void initServo()
{
  Servo1Position = 210;
  Servo5Position = 210;
  Servo9Position = 230;
  Servo13Position = 210;
  Servo0Position = 220;
  Servo4Position = 200;
  Servo8Position = 190;
  Servo12Position = 210;
}

void setServo()
{
  HCPCA9685.Servo(1, Servo1Position);
  HCPCA9685.Servo(5, Servo5Position);
  HCPCA9685.Servo(9, Servo9Position);
  HCPCA9685.Servo(13, Servo13Position);
  HCPCA9685.Servo(0, Servo0Position);
  HCPCA9685.Servo(4, Servo4Position);
  HCPCA9685.Servo(8, Servo8Position);
  HCPCA9685.Servo(12, Servo12Position);
}
void loop()
{
  if (!digitalRead(JoySwitch))
  {
    initServo();
    delay(500);
  }
  xAxis();
  yAxis();
  setServo();
}

Danke Dir
habs hinbekommen habe durch deinen Sketch das mit den ifs kappiert !!!

Danke und wieder was gelernt Nice!!!

#include "HCPCA9685.h"
#define I2CAdd 0x40
#define JoyX A0
#define JoyY A1
#define JoySwitch A2

int Servo0Position;
int Servo4Position;
int Servo8Position;
int Servo12Position;

int Servo1Position;
int Servo5Position;
int Servo9Position;
int Servo13Position;

HCPCA9685 HCPCA9685(I2CAdd);

void setup()
{
  HCPCA9685.Init(SERVO_MODE);
  HCPCA9685.Sleep(false);

  Servo0Position = 220;
  Servo4Position = 210;
  Servo8Position = 200;
  Servo12Position = 220;

  Servo1Position = 210;
  Servo5Position = 210;
  Servo9Position = 220;
  Servo13Position = 220;

  HCPCA9685.Servo(0, Servo0Position);
  HCPCA9685.Servo(4, Servo4Position);
  HCPCA9685.Servo(8, Servo8Position);
  HCPCA9685.Servo(12, Servo12Position);

  HCPCA9685.Servo(1, Servo1Position);
  HCPCA9685.Servo(5, Servo5Position);
  HCPCA9685.Servo(9, Servo9Position);
  HCPCA9685.Servo(13, Servo13Position);
  pinMode(JoySwitch, INPUT_PULLUP);
}

void loop()
{
  if (!digitalRead(JoySwitch))
  {
    delay(500);
    Servo0Position = 220;
    Servo4Position = 210;
    Servo8Position = 200;
    Servo12Position = 220;

    Servo1Position = 210;
    Servo5Position = 210;
    Servo9Position = 230;
    Servo13Position = 220;
  }
  if (analogRead(JoyY) > 800)
  {
    if (Servo0Position < 420)
    {
      Servo0Position++;
      Servo4Position++;
    }
    if (Servo12Position > 10)
    {
      Servo8Position--;
      Servo12Position--;
    }
    delay(1);
  }
  if (analogRead(JoyY) < 300)
  {
    if (Servo0Position > 10)
    {
      Servo0Position--;
      Servo4Position--;
    }
    if (Servo12Position < 420)
    {
      Servo8Position++;
      Servo12Position++;
    }
    delay(1);
  }
  if (analogRead(JoyX) > 800)

  {
    if (Servo1Position < 420)
    {
      Servo1Position++;
      Servo5Position++;
    }
    if (Servo13Position > 10)
    {
      Servo9Position--;
      Servo13Position--;
    }
    delay(1);
  }
  if (analogRead(JoyX) < 300)
  {
    if (Servo1Position > 10)
    {
      Servo1Position--;
      Servo5Position--;
    }
    if (Servo13Position < 420)
    {
      Servo9Position++;
      Servo13Position++;
    }
    delay(1);
  }
  HCPCA9685.Servo(0, Servo0Position);
  HCPCA9685.Servo(12, Servo12Position);
  HCPCA9685.Servo(4, Servo4Position);
  HCPCA9685.Servo(8, Servo8Position);

  HCPCA9685.Servo(1, Servo1Position);
  HCPCA9685.Servo(13, Servo13Position);
  HCPCA9685.Servo(5, Servo5Position);
  HCPCA9685.Servo(9, Servo9Position);
}

Das war nur ein Versuch von mir, ob die Vorgabe von mir richtig verstanden wird.
DAS fällt Dir aber so auf die Füsse!

Schau Dir an, wie ich das gebaut habe.