buttonMove

buttonControl

move mimicArm robot arm with buttons and potentiometer

Using the inputBox we can move the robot using buttons, the potentiometer, and the force sensitive resistor.

Commands Used

robotActivate();

robotMove(x,y);

robotJog(x,y);

robotGrab(x);

gripperMove(x);

inputBoxActivate();

buttonRead(x);

readPot();

readForce();

 

buttonControl.ino


Cut and paste code:

#include <robot.h>
#include <inputBox.h>

void setup() {
  robotActivate();    //start communication with the robot
  inputBoxActivate(); //start communication with the inputBox

}

void loop() {
  if (readButton(1)) robotJog(3, 1);   //if top button pressed, move up
  if (readButton(2)) robotJog(1, -1);  //if left button pressed move left
  if (readButton(3)) robotJog(1, 1);   //if right button pressed move right
  if (readButton(4)) robotJog(3, -1);  //if bottom button pressed move down
  robotMove(2, readPot());             //use pot to move in/out
  if(!readForce()) gripperMove(200);   //if force is 0 (false) move to position 200
  else robotGrab(readForce());         //otherwise grab at force
}