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