arm control

Hi, I have set-up a 5 dof robotic arm with my arduino. I want it so that I can control all the servos individually with one potentiometer. I have 5 leds to indicate which servo I am controlling and 3 buttons one left to scroll left and one right to scroll right and a third button to tell the ardunio when to listen to the potentiometer as when scrolling trough I don't want to change the servos I don't want to change.
But it isn't working and I am not to fluent at coding since i am still in school and haven't had that much experience with arduino and I would like some help.

Here is the code:

#include <Servo.h> 
 
Servo myservo1;  
Servo myservo2;
Servo myservo3;
Servo myservo4;
Servo myservo5;
int potpin = A0;  
int val = 0;    
int servoNo = 0;
int active =0;
int leftBut = 0;
int rightBut = 1;
int midBut = 2;
int ledPins[] = {4,5,6,7,8};
 
void setup() 
{ 
  myservo1.attach(9);  
  myservo2.attach(10);
  myservo3.attach(11);
  myservo4.attach(12);
  myservo5.attach(13);
  pinMode(leftBut, INPUT);
  pinMode(rightBut, INPUT);
  pinMode(midBut, INPUT);
  pinMode(ledPins[1], INPUT);
  pinMode(ledPins[2], INPUT);
  pinMode(ledPins[3], INPUT);
  pinMode(ledPins[4], INPUT);
  pinMode(ledPins[5], INPUT);
  Serial.begin(9600);    
  }

 
 
void loop() 
{ 
  int servoNo = 0;
  if (Serial.available()) 
  {
    Serial.write(servoNo);
  }
  int leftButPress = digitalRead(leftBut);
  int midButPress = digitalRead(midBut);
  int rightButPress = digitalRead(rightBut);
  if (leftButPress = HIGH)
 {
   servoNo - 1;  
 } 
 if (rightButPress = HIGH)
 {
   servoNo + 1;
 }
 if (midButPress = HIGH)
 {
   active = 1;
 }
 else
 {
   active = 0;
 }
 if (servoNo = 6)
 {
   servoNo = 0;
 }
 if (servoNo = -1)
 {
   servoNo = 6;
 }
 
digitalWrite(ledPins[servoNo], HIGH);
 
 
 if (active = 1)
 {
   val = analogRead(potpin);            
   val = map(val, 0, 1023, 0, 179); 
   if(servoNo = 0) myservo1.write(val);
   if(servoNo = 1) myservo2.write(val);
   if(servoNo = 2) myservo3.write(val);
   if(servoNo = 3) myservo4.write(val);
   if(servoNo = 4) myservo5.write(val);
  delay(15);
 }                                     
}

I haven't had a proper look yet, but all of the "if" lines like this one with the =:

 if (rightButPress = HIGH)

.... need to use the == and look like this:

 if (rightButPress == HIGH)

Edit: see the warning on this page

You need to only cause actions to happen when the buttons change state -
if you cause your action when the button reads HIGH the action will be happening
100,000's of times a second while the button is pushed.

You need code that detects a change in button state, and also that debounced
the button, so that only one action happens from pressing the button each time.

[ BTW have you looked at the relevant examples in section 02.Digital ? You should ]

  if (Serial.available()) 
  {
    Serial.write(servoNo);
  }

If there is any serial data to read, don't read it. Instead, write a 0 to the serial port.

What possible use is that?

   servoNo - 1;

Subtract one from servoNo, and discard the result. What possible use is that?

   servoNo + 1;

Add one to servoNo, and discard the result. What possible use is that?

 if (servoNo = 6)
 {
   servoNo = 0;
 }
 if (servoNo = -1)
 {
   servoNo = 6;
 }

Given that you have 5 servos, why is the limiting value 6? 5 is not a valid servo number. 0 to 4 are.

You COULD put the servo instances in an array, and not have to test for 5 different values of servoNo.