Skip to content

Commit f5d1558

Browse files
committed
move thumb first or last so it doesnt get stuck
1 parent 9f9c670 commit f5d1558

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

HandServos.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,21 +209,14 @@ void HandServos::moveServos2(String input) {
209209
Serial.println(pieces[2]);
210210
Serial.println(pieces[3]);
211211

212-
// T
213-
if (lastPosT > pieces[0].toInt()) {
214-
for (int i = lastPosT; i > pieces[0].toInt(); i--) {
215-
servoT.write(i);
216-
lastPosT = servoT.read();
217-
delay(15);
218-
}
219-
} else if (lastPosT > pieces[0].toInt()) {
212+
if (lastPosT < pieces[0].toInt()) {
220213
for (int i = lastPosT; i < pieces[0].toInt(); i++) {
221214
servoT.write(i);
222215
lastPosT = servoT.read();
223216
delay(15);
224217
}
225218
}
226-
219+
227220
// I
228221
if (lastPosI > pieces[1].toInt()) {
229222
for (int i = lastPosI; i > pieces[1].toInt(); i--) {
@@ -268,4 +261,12 @@ void HandServos::moveServos2(String input) {
268261
delay(15);
269262
}
270263
}
264+
265+
if (lastPosT > pieces[0].toInt()) {
266+
for (int i = lastPosT; i > pieces[0].toInt(); i--) {
267+
servoT.write(i);
268+
lastPosT = servoT.read();
269+
delay(15);
270+
}
271+
}
271272
}

0 commit comments

Comments
 (0)