Last active
April 21, 2016 12:14
-
-
Save AlexanderBrevig/a777c792ad2ac23344e6 to your computer and use it in GitHub Desktop.
An example using a new Braccio library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Braccio.h> | |
#include <Servo.h> | |
Servo base; | |
Servo shoulder; | |
Servo elbow; | |
Servo wristRotate; | |
Servo wristVertical; | |
Servo gripper; | |
Braccio robot; | |
void setup() { | |
// attach servos | |
base.attach(11); | |
shoulder.attach(10); | |
elbow.attach(9); | |
wristRotate.attach(6); | |
wristVertical.attach(5); | |
gripper.attach(3); | |
// configure robot | |
robot.base(base); | |
robot.shoulder(shoulder); | |
robot.elbow(elbow); | |
robot.wristRotate(wristRotate); | |
robot.wristVertical(wristVertical); | |
robot.gripper(gripper); | |
///Start Braccio in it's safe 'home' position | |
robot.home(); | |
} | |
void loop() { | |
robot.base(15); | |
robot.shoulder(0); | |
robot.elbow(180); | |
robot.wristVertical(170); | |
robot.wristRotate(0); | |
robot.gripper(73); | |
robot.move(20); //spend 20 ms getting there from where we are now | |
delay(1000); | |
//old API for reference - IMHO completely unintuitive | |
//Braccio.ServoMovement(20, 165, 180, 0, 0, 180, 10); | |
robot.base(165); | |
robot.shoulder(180); | |
robot.elbow(0); | |
robot.wristVertical(0); | |
robot.wristRotate(180); | |
robot.gripper(10); | |
robot.move(); //instantly move to target | |
delay(2000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment