[SOLVED]Was not declared in this scope

Hey everybody!

So, I’m working on using joysticks to control a robot arm I made. I finished writing the code for the joystick input but I keep getting an error “was not declared in this scope”. I’m an alright programmer, I’m for sure not the best, but I don’t know what cases the issue.

If anybody would like to shed some light on what causes the issue id be more than happy, also any other feedback on errors, bugs or optimization would be nice, you learn from your mistakes.

Thanks, in advanced!

#include <Servo.h>

const int servoBas = 11;       
const int servoLeft = 10;       
const int servoRight = 9;
const int servoClaw = 6;

const int joyH = 5;        // L/R Parallax Thumbstick
const int joyV = 4;        // U/D Parallax Thumbstick
const int joyH1 = 3;
const int joyV1 = 2;

int servoVal1;           // variable to read the value from the analog pin
int servoVal2;
int servoVal3;
int servoVal4;

Servo myservoBas;  // create servo object to control a servo
Servo myservoLeft;  // create servo object to control a servo
Servo myservoRight;
Servo myservoClaw;


//String Hanna = "BAJSKORV"; //create servo object to control shitflow

void setup() {

  // Servo  
  myservoBas.attach(servoBas);  // attaches the servo
  myservoLeft.attach(servoLeft);  // attaches the servo
  myservoRight.attach(servoRight);
  myservoClaw.attach(servoClaw);

  // Inizialize Serial
  Serial.begin(9600);
}


void loop(){

    // Display Joystick values using the serial monitor
    outputJoystick();

    // Read the horizontal joystick value  (value between 0 and 1023)
    servoVal1 = analogRead(joyH);          
    servoVal1 = map(servoVal1, 0, 1023, 0, 180);     // scale it to use it with the servo (result  between 0 and 180)
    

    myservoLeft.write(servoVal1);                         // sets the servo position according to the scaled value    

    // Read the horizontal joystick value  (value between 0 and 1023)
    servoVa2 = analogRead(joyV);           
    servoVa2 = map(servoVal2, 0, 1023, 70, 180);     // scale it to use it with the servo (result between 70 and 180)

    myservoBas.write(servoVal2);        


    servoVa3 = analogRead(joyV1);           
    servoVa3 = map(servoVal3, 0, 1023, 70, 180);     

    myservoBas.write(servoVal3);  

    servoVa4 = analogRead(joyH1);           
    servoVa4 = map(servoVal4, 0, 1023, 70, 180);   

    delay(15);                                       // waits for the servo to get there

}


/**
* Display joystick values
*/
void outputJoystick(){

    Serial.print(analogRead(joyH));
    Serial.print ("---"); 
    Serial.print(analogRead(joyV));
    Serial.println ("----------------");
    Serial.print(analogRead(joyH1));
    Serial.print ("---"); 
    Serial.print(analogRead(joyV1));
    Serial.println ("----------------");
}

Jeez what " "was not declared in this scope" ?

I'm an alright programmer,

but I haven't figured out arrays yet.

servoVa2 was not declared in scope?

(I'm guessing the compiler already told you that, but you decided not to share)

Groove:
Jeez what was " "was not declared in this scope" ?
but I haven't figured out arrays yet.

Or what scope means

Like I said an "alright programmer" I realized that I misspelled "servoValx". I know what a scope is and I tough id spelled it correctly and that’s why I couldn’t figure out why it wasn’t declaring (Maybe I’d done something else wrong) thanks anyway for the help.

Were you not seeing the whole error message? The error message specifies that it's servoVa2 that's not declared, but the way you're talking it sounds like you were seeing the message starting with the first word after the name of the variable it wasn't finding the declaration for.