Help with Robotic Hand coding

Hey!
So I’ll make this as short as possible, I’m a first year Architecture student and in my first semester I was selected to be in the first year’s honor’s program, and decided to make a movable robotic hand for the exhibition that it will be held in, as I researched how to make it I saw many projects using an Arduino chip, it was the easiest thing I could come up with as I’m not really qualified for any engineering matters, so I got the Arduino Mega 2560 chip and copy/pasted the code that one of the projects had on youtube after I knew they were okay with me using the code, unfortunately it didn’t work and theres always an error, i’m panicking like crazy because I have no idea how to use coding in order to activate the hand, please help out I will be eternally grateful and mention you in my process of the project of course.

Materials I’m using:
5 standard servos, 4.8-6V ( for each finger)
Arduino mega 2560
6" m/m premium jumper wires
2 1/8" modular breadboard socket

Below is the video:

and here is the code:

#include <Servo.h> 

Servo d0;
Servo d1;
Servo d2;
Servo d3;
Servo d4;

int pos = 0;

void setup() 
{ 
  d4.attach(9);
  d3.attach(8);
  d2.attach(7);
  d1.attach(6);
  d0.attach(5);
} 


void loop() 
{ 
  for(pos = 0; pos < 180; pos += 1)
  {
    d0.write(pos);
    d1.write(pos);
    d2.write(pos);
    d3.write(pos);
    d4.write(pos);
    delay(15);
  } 
  for(pos = 180; pos>=1; pos-=1)
  {
    d0.write(pos);
    d1.write(pos);
    d2.write(pos);
    d3.write(pos);
    d4.write(pos);
    delay(15);
  }
  for(pos = 0; pos < 180; pos += 1)
  {
    d0.write(pos);
    d1.write(pos);
    d2.write(pos);
    d3.write(pos);
    d4.write(pos);
    delay(15);
  } 
  for(pos = 180; pos>=1; pos-=1)
  {
    d0.write(pos);
    d1.write(pos);
    d2.write(pos);
    d3.write(pos);
    d4.write(pos);
    delay(15);
  }
  delay(1000);
  d0.write(180);
  d1.write(180);
  d2.write(180);
  d3.write(180);
  d4.write(180);
  delay(2000);
  d0.write(0);
  d1.write(0);
  d2.write(0);
  d3.write(0);
  d4.write(0);
  delay(1000);
  d0.write(180);
  d1.write(180);
  d2.write(180);
  d3.write(180);
  d4.write(180);
  delay(2000);
  d1.write(0);
  delay(1000);
  d2.write(0);
  delay(1000);
  d3.write(0);
  delay(1000);
  d4.write(0);
  delay(1000);
  d0.write(0);
  delay(2000);
}
/code]

Learn to crawl before you start running.

Start with one servo and understand how to make the arm move, and what the number in "d0.write(number)" means.

Figure out how that servo arm movement can be turned into some particular hand motion.

Add more servos.

Never power a servo from the Arduino. Use a separate servo power supply and connect all the grounds together.

thanks for your reply and you're right should learn how to use one servo first but I don't know how to start the coding and i'm only using the hand as in the palm not the arm at all

unfortunately it didn’t work and theres always an error

YOU are the only one that can see what “it didn’t work” means and what the error is. Pretend that we are blind, and tell us what the problem is.

YOU are the only one that can see what "it didn't work" means and what the error is. Pretend that we are blind, and tell us what the problem is.

Okay so the problem I don't really understand what it wants me to correct when i upload the code to the Arduino chip, this error is what comes up:

Arduino: 1.8.0 (Mac OS X), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Sketch uses 3788 bytes (1%) of program storage space. Maximum is 253952 bytes. Global variables use 179 bytes (2%) of dynamic memory, leaving 8013 bytes for local variables. Maximum is 8192 bytes. avrdude: ser_open(): can't open device "COM1": No such file or directory ioctl("TIOCMGET"): Inappropriate ioctl for device ioctl("TIOCMGET"): Inappropriate ioctl for device avrdude: ser_send(): write error: Bad file descriptor avrdude: stk500_send(): failed to send command to serial port avrdude: stk500v2_ReceiveMessage(): timeout avrdude: ser_send(): write error: Bad file descriptor avrdude: stk500_send(): failed to send command to serial port avrdude: stk500v2_ReceiveMessage(): timeout avrdude: ser_send(): write error: Bad file descriptor avrdude: stk500_send(): failed to send command to serial port avrdude: stk500v2_ReceiveMessage(): timeout avrdude: ser_send(): write error: Bad file descriptor avrdude: stk500_send(): failed to send command to serial port avrdude: stk500v2_ReceiveMessage(): timeout avrdude: ser_send(): write error: Bad file descriptor avrdude: stk500_send(): failed to send command to serial port avrdude: stk500v2_ReceiveMessage(): timeout avrdude: ser_send(): write error: Bad file descriptor avrdude: stk500_send(): failed to send command to serial port avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer the selected serial port avrdude: stk500v2_getsync(): timeout communicating with programmer does not exist or your board is not connected

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

avrdude: ser_open(): can't open device "COM1": No such file or directory

You have the wrong serial port selected on the MAC, or you have not properly connected the Arduino board to the MAC, or you have incorrectly configured the Arduino IDE software.

Start with the "Blink" program example in the Arduino IDE and get that working first.

You have the wrong serial port selected on the MAC./quote]

you are absolutely right! I turned out that it really was the wrong serial port, I cant thank you enough, this saved my whole project, thanks again!