braccio robot process idea

I'm currently working on a project with the idea of implementing a limit switch to activate my braccio robot to go pic something up. I've defined the pins within sketch and the it seems like the braccio.ServoMovement won't achieve movement if the switch goes low. Should I individually assign each servo motor to their respective pins and try to move the servos individually? Any help is apprecialted.
Thanks,
D

Did you forget something?

If you’re referring to code here it is. I’m really new to all of this just looking for some help. I’m wondering if I’m doing something wrong with the limit switch because when I start running the code the robot moves regardless of the position of the limit switch.

#include <Servo.h>

#include <Braccio.h>

int Lswitch=2;
int flag=0;
int m1= 11;
int m2= 10;
int m3= 9;
int m4= 6;
int m5= 5;
int m6= 3;

Servo base;
Servo shoulder;
Servo elbow;
Servo wrist_rot;
Servo wrist_ver;
Servo gripper;

void setup() {
pinMode(Lswitch,INPUT);
pinMode(m1,OUTPUT);
pinMode(m2,OUTPUT);
pinMode(m3,OUTPUT);
pinMode(m4,OUTPUT);
pinMode(m5,OUTPUT);
pinMode(m6,OUTPUT);

//Initialization functions and set up the initial position for Braccio
//All the servo motors will be positioned in the “safety” position:
//Base (M1):90 degrees
//Shoulder (M2): 45 degrees
//Elbow (M3): 180 degrees
//Wrist vertical (M4): 180 degrees
//Wrist rotation (M5): 90 degrees
//gripper (M6): 10 degrees
Braccio.begin();
}

void loop()
{
if( (digitalRead(Lswitch) == LOW) && (flag == 1))
{

flag=0;
delay(20);
}
if( flag == 0)
{
Braccio.ServoMovement (50, 90, 90, 90,90, 90, 50);
delay(500);

}

Have a look at the forum guide re code tags

Dburtnett1085:
If you’re referring to code here it is.

Code, schematic…