Skip to content

Commit fcf1033

Browse files
committed
add pinch movement
1 parent 776f662 commit fcf1033

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

examples/Controlling_Manually_Braccio/Controlling_Manually_Braccio.ino

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#define COLOR_YELLOW 0xE5AD24
99

1010
// Variables
11-
float homePos[6] = {157.5, 157.5, 157.5, 157.5, 157.5, 90.0};
11+
float homePos[6] = {157.5, 157.5, 157.5, 157.5, 157.5, 190.0};
1212
float angles[6]; // All motors current angles
1313

1414
// Braccio ++ joints
@@ -25,7 +25,8 @@ String selectedJoints = "Shoulder";
2525
enum states {
2626
SHOULDER,
2727
ELBOW,
28-
WRIST
28+
WRIST,
29+
PINCH
2930
};
3031

3132
int state = SHOULDER;
@@ -73,6 +74,12 @@ void moveJoints(uint32_t btnID) {
7374
default: break;
7475
}
7576
break;
77+
case PINCH:
78+
switch (btnID) {
79+
case 1: gripper.move().to(angles[0] + 10.0); break;
80+
case 2: gripper.move().to(angles[0] - 10.0); break;
81+
default: break;
82+
}
7683
default:
7784
break;
7885

@@ -95,7 +102,7 @@ static void eventHandlerDirectional(lv_event_t * e) {
95102
//mainMenu(); // Load motor menu screen
96103
//lv_obj_del(directional); // Delete the object
97104
state++;
98-
if (state > WRIST) {
105+
if (state > PINCH) {
99106
state = SHOULDER; // restart from the shoulder
100107
}
101108
}

0 commit comments

Comments
 (0)