More servo motors

The hardware guy try to make the software to manage several small servo motors from Arduino, but NO success!
I like to control more servo motors by analog inputs and potentiometers.
The original code works fine, but I am not able to add more motors to control by other inputs.
As you can see I add the second object, but then ONLY last one work?

#include <Servo.h> //Arduino standard library
#define servopin 9
#define servopina 8// This define pin 9 as the pin for the servo control

#define PotentiometerPin 0
#define PotentiometerPina 1 // use A0 as input for the potentiometer swiper

Servo myservo; // instantiate a Servo object named ‘myservo’
Servo mysevoa; // a maximum of eight servo objects can be created

void setup()
Serial.begin(9600); // Start serial port
myservo.attach(servopina);//attaches the servo on pin 9 to the servo object

void loop()
int val=0; // define a temporary variable for storing the potentiometer setting
val = analogRead(PotentiometerPin);
val = analogRead(PotentiometerPina);//read analog pin voltage. 0-5V are ‘projected’ onto a number range of val-0-1-23

myservo.write(map(val,0,1023,0,180)); //tell servo to go to a position proportional to the potentiometer position
Serial.println(; //this retrives servo position and sends it to the serial monitor


Anybody can help me?
Thank you


You're attaching the same servo to different pins - only the last one will be the one actually attached to.

Please get into the habit of using code tags when posting code.

I mentioned "the hardware guy"! I am trying for several days, but don't know how to do it.

Try attaching myservoa to servopina.

Or did you mean you don't know how to use code tags?

I have no experience in coding (learning!!!!). I am developing the hardware device and need this function for testing. Later (if work) will look for coder to help me develop the application, but can not move forward without this!