tinyBotGrabAndDrop
tinyBotGrabAndDrop
tinyBotGrabAndDrop uses the gripper AND moves a servo! The robotGrab command sets the force tinyBot applies with the gripper. Positive numbers close the gripper, negative numbers open it. Like moving servos fast, the robotGrab command requires a delay. After tinyBot has grabbed the block the next command changes the robots position.
Commands used:
robotGrab(<force>)
delay(<time>)
What We Learn:
This is the simplest of multi step grabbing programs. Even though we're only using one of tinyBot's servos and the gripper you can get a feel for how a more complicated program might work.
Download Files:
Download tinyBotGrabAndDrop.ino for Arduino
Download tinyBotGrabAndDrop.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.
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(1,200);
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(1,127);
}