Deep Think Project - Artificial Intelligence Research Project

Hello everyone,

I have been working on some basic functions for movement, and although the code compiles fine, it doesn't do what I want. The robot takes a long time to initialize, and then it just raises it's left arm. I don't know what's wrong with my code even after hours of looking at it, so I am posting it here. Here is my code.

//
// Deep Think 0.0.0.2
//
// programmed by George Andrews
//
// NOTE: This program is designed for the Meccanoid G15 (combined
// with the 86Duino One). It is a part of the Deep Think Project
// (first version of the software for the project). The Deep Think
// Project is designed to advance the intelligence (as well as
// motion and structural capabilities) of humanoid robots. This
// version of the program is designed to do the following.
//
// 1. Perform various moves using functions.
// 2. Control the 2 D/C motors with the 86Duino.
//
// Please note that this version is only intended as a demo to
// establish a basic framework for interfacing the Meccanoid
// electronic parts with the 86Duino One for future development.
// This version of the software, however, has the following
// additional capabilities compared to the previous version Deep
// Think 0.0.0.1.
//
// 1. Can interface with the D/C motors as well as the servos and
//    LED eyes.
// 2. Can perform various moves using functions in the program.
//

#include "MeccaBrain.h"

//
// Variables
//

// pin declarations
int LeftArmDaisyChainPin = 21;
int LEDEyePin = 29;
int RightArmDaisyChainPin = 38;
int LeftFootDCMotorPin = 11;
int RightFootDCMotorPin = 13;

// class objects
MeccaBrain LeftArmDaisyChain(LeftArmDaisyChainPin);
MeccaBrain LEDEye(LEDEyePin);
MeccaBrain RightArmDaisyChain(RightArmDaisyChainPin);

//
// Functions
//

void WaveWithLeftArm()
{
  // up
  LeftArmDaisyChain.setServoPosition(0, 200);
  LeftArmDaisyChain.communicate();
  
  // let motors calibrate
  delay(500);
  
  // down
  LeftArmDaisyChain.setServoPosition(0, 127);
  LeftArmDaisyChain.communicate();
  
  // let motors calibrate
  delay(500);
  
  // up again
  LeftArmDaisyChain.setServoPosition(0, 200);
  LeftArmDaisyChain.communicate();
  
  // let motors calibrate
  delay(500);
  
  // down all the way
  LeftArmDaisyChain.setServoPosition(0, 0);
  LeftArmDaisyChain.communicate();
}

void WaveWithRightArm()
{
  // up
  RightArmDaisyChain.setServoPosition(0, 55);
  RightArmDaisyChain.communicate();
  
  // let motors calibrate
  delay(500);
  
  // down
  RightArmDaisyChain.setServoPosition(0, 127);
  RightArmDaisyChain.communicate();
  
  // let motors calibrate
  delay(500);
  
  // up again
  RightArmDaisyChain.setServoPosition(0, 55);
  RightArmDaisyChain.communicate();
  
  // let motors calibrate
  delay(500);
  
  // down all the way
  RightArmDaisyChain.setServoPosition(0, 255);
  RightArmDaisyChain.communicate();
}

void RaiseLeftHand()
{
  LeftArmDaisyChain.setServoPosition(0, 200);
  LeftArmDaisyChain.communicate();
}

void RaiseRightHand()
{
  RightArmDaisyChain.setServoPosition(0, 55);
  RightArmDaisyChain.communicate();
}

void PutDownLeftHand()
{
  LeftArmDaisyChain.setServoPosition(0, 0);
  LeftArmDaisyChain.communicate();
}

void PutDownRightHand()
{
  RightArmDaisyChain.setServoPosition(0, 255);
  RightArmDaisyChain.communicate();
}

void TurnLeft()
{
  analogWrite(RightFootDCMotorPin, 255);
  delay(3000);
}

void TurnRight()
{
  analogWrite(LeftFootDCMotorPin, 255);
  delay(3000);
}

void MoveForward()
{
  analogWrite(LeftFootDCMotorPin, 255);
  analogWrite(RightFootDCMotorPin, 255);
  delay(3000);
}

// bends at elbow with hand in front of robot
void ReceiveWithLeftHand()
{
  LeftArmDaisyChain.setServoPosition(1, 255);
  LeftArmDaisyChain.communicate();
}

// bends at elbow with hand in front of robot
void ReceiveWithRightHand()
{
  RightArmDaisyChain.setServoPosition(1, 0);
  RightArmDaisyChain.communicate();
}

void setup()
{
  // set up DC motors
  pinMode(
}

void loop()
{
  RaiseLeftHand();
  RaiseRightHand();
  delay(2000);
  PutDownLeftHand();
  PutDownRightHand();
  delay(2000);
  
  WaveWithLeftArm();
  delay(2000);
  WaveWithRightArm();
  delay(2000);
  
  TurnLeft();
  delay(1000);
  TurnRight();
  delay(1000);
  
  MoveForward();
  delay(2000);
  
  ReceiveWithLeftHand();
  delay(2000);
  PutDownLeftHand();
  delay(2000);
  
  ReceiveWithRightHand();
  delay(2000);
  PutDownRightHand();
  delay(2000);
}

Thank you,
goodinventor