slowWave

slowWave

A simple program made with complex commands!  This example introduces "while" and "robotJog".  Sometimes it's desirable or required to move slowly.  This example shows how to control the robots movement speed.

Commands Used

robotMove(x,y);

robotJog(x,y);

while(logical test);

Download slowWave.ino for Arduino

Download GrabAndDrop.abp for mimicBlock

Cut and paste code:

#include <robot.h>    //Tell your arduino to go get the custom mimicArm code
void setup() {
  // put your setup code here, to run once:
  robotActivate();  //Tell the robot that Arduino will be sending it commands
}

void loop() {
  // put your main code here, to run repeatedly:
  robotMode(arduino);  //Put the robot in Arduino command mode

  robotMove(1,127);  //Center the robot on it's base
  robotMove(2,127);   //Put the robots 'shoulder' in a natural position  
  robotMove(3,90);   //Put robot 'elbow' at botom of wave
 
//move robot to top of wave
  while(robotPosition(3) < 200){
    robotJog(3,1);  //jog robot up 1 unit until reaching 200
    delay(10);
  }
 
//Move robot backt to bottom of wave
  while(robotPosition(3) > 90){
    robotJog(3,-1);
    delay(10);
  }
}