ARA Coding Challenge - Snippet #1 - EoC

PHOTO EMBED

Sun Dec 15 2024 04:09:30 GMT+0000 (Coordinated Universal Time)

Saved by @TechBox #c++

// Challenge Solution Functions
void Position_1() // Starting "Prep" position
{
  // Set the target positions to the starting positions
  posBase = 125;
  posShoulder = 55;
  posElbow = 50;
  posGripper = 0;

  // Write the starting position to each servo.
  servoBase.write(posBase);
  servoShoulder.write(posShoulder);
  servoElbow.write(posElbow);
  servoGripper.write(posGripper);
}


void Position_2() // "Grab" position
{
  // Set the target positions to the starting positions
  posBase = 125;
  posShoulder = 75;
  posElbow = 40;
  posGripper = 90;

  // Write the starting position to each servo.
  servoBase.write(posBase);
  servoShoulder.write(posShoulder);
  servoElbow.write(posElbow);
  servoGripper.write(posGripper);
}


void Position_3() // "Lift" position
{
  // Set the target positions to the starting positions
  posBase = 125;
  posShoulder =55;
  posElbow = 90;
  posGripper = 90;

  // Write the starting position to each servo.
  servoBase.write(posBase);
  servoShoulder.write(posShoulder);
  servoElbow.write(posElbow);
  servoGripper.write(posGripper);
}


void Position_4() // "Move" Position
{
  // Set the target positions to the starting positions
  posBase = 55;
  posShoulder =55;
  posElbow = 90;
  posGripper = 90;

  // Write the starting position to each servo.
  servoBase.write(posBase);
  servoShoulder.write(posShoulder);
  servoElbow.write(posElbow);
  servoGripper.write(posGripper);
}


void Position_5() // "Place" Position
{
  // Set the target positions to the starting positions
  posBase = 55;
  posShoulder = 75;
  posElbow = 40;
  posGripper = 60;

  // Write the starting position to each servo.
  servoBase.write(posBase);
  servoShoulder.write(posShoulder);
  servoElbow.write(posElbow);
  servoGripper.write(posGripper);
}


void Position_6() // "Depart" Position
{
  // Set the target positions to the starting positions
  posBase = 55;
  posShoulder = 55;
  posElbow = 50;
  posGripper = 0;

  // Write the starting position to each servo.
  servoBase.write(posBase);
  servoShoulder.write(posShoulder);
  servoElbow.write(posElbow);
  servoGripper.write(posGripper);
}
content_copyCOPY