1 | /*
|
---|
2 | testBraccio90.ino
|
---|
3 |
|
---|
4 | testBraccio90 is a setup sketch to check the alignment of all the servo motors
|
---|
5 | This is the first sketch you need to run on Braccio
|
---|
6 | When you start this sketch Braccio will be positioned perpendicular to the base
|
---|
7 | If you can't see the Braccio in this exact position you need to reallign the servo motors position
|
---|
8 |
|
---|
9 | Created on 18 Nov 2015
|
---|
10 | by Andrea Martino
|
---|
11 |
|
---|
12 | This example is in the public domain.
|
---|
13 | */
|
---|
14 |
|
---|
15 | #include <Braccio.h>
|
---|
16 | #include <Servo.h>
|
---|
17 |
|
---|
18 |
|
---|
19 | Servo base;
|
---|
20 | Servo shoulder;
|
---|
21 | Servo elbow;
|
---|
22 | Servo wrist_rot;
|
---|
23 | Servo wrist_ver;
|
---|
24 | Servo gripper;
|
---|
25 |
|
---|
26 | void setup() {
|
---|
27 | //Initialization functions and set up the initial position for Braccio
|
---|
28 | //All the servo motors will be positioned in the "safety" position:
|
---|
29 | //Base (M1):90 degrees
|
---|
30 | //Shoulder (M2): 45 degrees
|
---|
31 | //Elbow (M3): 180 degrees
|
---|
32 | //Wrist vertical (M4): 180 degrees
|
---|
33 | //Wrist rotation (M5): 90 degrees
|
---|
34 | //gripper (M6): 10 degrees
|
---|
35 | Braccio.begin();
|
---|
36 | }
|
---|
37 |
|
---|
38 | void loop() {
|
---|
39 | /*
|
---|
40 | Step Delay: a milliseconds delay between the movement of each servo. Allowed values from 10 to 30 msec.
|
---|
41 | M1=base degrees. Allowed values from 0 to 180 degrees
|
---|
42 | M2=shoulder degrees. Allowed values from 15 to 165 degrees
|
---|
43 | M3=elbow degrees. Allowed values from 0 to 180 degrees
|
---|
44 | M4=wrist vertical degrees. Allowed values from 0 to 180 degrees
|
---|
45 | M5=wrist rotation degrees. Allowed values from 0 to 180 degrees
|
---|
46 | M6=gripper degrees. Allowed values from 10 to 73 degrees. 10: the toungue is open, 73: the gripper is closed.
|
---|
47 | */
|
---|
48 |
|
---|
49 | // the arm is aligned upwards and the gripper is closed
|
---|
50 | //(step delay, M1, M2, M3, M4, M5, M6);
|
---|
51 | Braccio.ServoMovement(20, 90, 90, 90, 90, 90, 73);
|
---|
52 |
|
---|
53 | }
|
---|