tinyBotReachGrabAndDrop

tinyBotReachGrabAndDrop

tinyBot Reaches for a Block then Drops it

tinyBotReachGrabAndDrop uses the gripper and moves TWO servos! This program is a good foundation into programs that actually do something useful. The robot anticipates the block and reaches for it, before deciding "Nope, don't want that!"

Commands used:

robotGrab(<force>)

delay(<time>)

What We Learn:

There's nothing new here, but we're practicing sequencing actions to produce a result.

Download Files:

Download tinyBotReachGrabAndDrop.ino for Arduino

Download tinyBotReachGrabAndDrop.adp for mimicBlock

Cut and paste code:

  #include <robot.h>

void setup() {
  // put your setup code here, to run once:
  robotActivate();

}

void loop() {
  // put your main code here, to run repeatedly:
 
  delay(5000);  //this command waits for 5000 milliseconds, which is the same as 5 seconds.
  robotMove(2,100);  //reach out to get the block
  robotGrab(100);   //The higher the number, the harder the robot grabs. 127 is the maximum
  delay(2000);  //let's wait 2000 milliseconds (2 seconds) to make sure the robot has a good grip
  robotMove(2,130);
  robotMove(1,200);
  robotMove(2,100);
  robotGrab(-100);  //the negative number will open the gripper
  delay(1000);
  robotGrab(0);  //we need to turn off the gripper by resting to zero. That keeps it from wearing out.
  robotMove(2,150);
  robotMove(1,127);

}