Skip to content

Commit 6857340

Browse files
committed
Use constants and print current angle as obtained from Braccio smart servos.
1 parent db5084a commit 6857340

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

examples/Tools/Test_Motor_Angular_Control/Test_Motor_Angular_Control.ino

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,17 @@ void loop()
3232
return;
3333
}
3434

35-
for (float angle = 0.0; angle <= 180.0; angle += 10.0) {
35+
float const ANGLE_START = 0.0;
36+
float const ANGLE_STOP = 180.0;
37+
float const ANGLE_INCREMENT = 10.0;
38+
39+
for (float angle = ANGLE_START; angle <= ANGLE_STOP; angle += ANGLE_INCREMENT)
40+
{
3641
Braccio.move(selected_motor).to(angle);
37-
Serial.println("Current angle: " + String(angle));
42+
Serial.print("Target angle: " + String(angle));
43+
Serial.print(" | ");
44+
Serial.print("Current angle: " + String(Braccio.get(selected_motor).position()));
45+
Serial.println();
3846
delay(100);
3947
}
4048
}

0 commit comments

Comments
 (0)