Integrating LewanSoul X arm with arduino uno

Hello,
So My idea is to have a limit switch mounted on a 3d printer. Once the printer goes to the home position after its done the robot will then move and pick the part up off of the printer. I have the limit switch code down I believe. From this point how do I code to have the robot make the appropriate moves to pick the part up. See the code below.

#include "xArmServoController.h"
xArmServoController xarm1 = xArmServoController(Serial1);

#define XarmServo
#define setPosition

int Lswitch = 2;
int led = 13;
int flag = 0;
#define setPostion

void setup()
{
Serial.begin(9600);
pinMode(Lswitch, INPUT);
pinMode(led, OUTPUT);

}

void loop()
{
if( (digitalRead(Lswitch) == LOW) && (flag == 0) )
{
Serial.println("3D Printer is in Home Position ");

flag = 1;
delay(20);
}

if( (digitalRead(Lswitch) == HIGH) && (flag == 1) )
{
Serial.println("3D Printer is in operation");
flag = 0;
delay(20);

if ( flag == 1 )
{
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);
delay(1000);
`
}

if ( flag == 1 )
{
digitalWrite(led, LOW);
}

digitalWrite(Lswitch, HIGH);

}

Please read the first topics like "How to use Forum", How to attach code.
Format the code in IDE. You will eadily find mismatching curly bracketd. That code hardly compiles.

#include "xArmServoController.h"
xArmServoController xarm1 = xArmServoController(Serial1);

You have a library to control the arm. You have told it that the arm is connected to Serial1.

NOTE: THE ARDUINO UNO DOES NOT HAVE A "Serial1". The Arduino Leonardo or Arduino MEGA do.

Look at the examples provided with the library to see how to control the arm. You should find them in the IDE under:

File->Examples->xArmServoController->

How does the robot get the part off the print bed? Usually they are stuck on pretty good unless you have a really nice bed surface, like a WhamBam system.