Gesture & Color sensing Robot Arm

Currently I am making a Robot arm having 2 modes of control;

  1. Gesture Control - Using 2 Adxl335 Accelerometers as it's a 6 DOF Robot arm which i have designed myself and will upload pictures tommorrow.. The hardware is ready.

  2. Color Sorting - TCS3200 Sensor will be used.

I have had a hard time figuring out the code and when i was done with it and tried implementing to hardware..It didn't work.
As it's my First Arduino Project and i have been designing and cutting out the hardware pieces for the past 2months.. I have got a week's time to submit my project in my University.

Here's the coding that i have done till now:
1.Gesture: I did on my own.
2.Color Sensor ( I will be honest, I got it from Google as i had no idea of how to start coding it)

Codes removed as i have attached the files because of 9000 char limit.

Please guide me where i am going wrong with the gesture part and also where should i put the Servo commands in the Color sorting Code.

Methodology:
Press Button 1: to activate Gesture Control Mode

Recieve the signals from the 2 ADXL335 accelerometers attached to my arm and perform the motion accordingly.

Press Button 2: to activate Color Sorting mode
Conveyor Belt starts and the objects start moving until the proximity sensor attached detects them. Then the color sensor gets activated -> takes RGB values-> 6 Servos move as programmed and drop the color objects in separate boxes assigned.

Please take an initiative to guide a fellow member of the Arduino Forums as it's very urgent.

AccRobot_Code.ino (5.08 KB)

Color_Sensor.ino (2.48 KB)