A servo arm is a mechanically attached arm driven by a servo motor to perform controlled physical movement. In a snack-pushing robot, it stays down while the robot travels, then swings up to knock over a matching snack before returning down. section 11.3 section 11.3.2
Control the arm as a reusable library function:
- Set named servo angles for the up and down positions. section 11.3.2
- Raise the arm, pause briefly, and return it to its original position. section 11.3.2
- Call the arm after QR-code navigation finds the requested snack and the robot backs into position. section 11.3.2
Swing the arm
from adafruit_crickit import crickit import time SERVO_ANGLES = dict(up=70, down=180) def swing_arm(): crickit.servo_2.angle = SERVO_ANGLES['up'] time.sleep(0.5) crickit.servo_2.angle = SERVO_ANGLES['down'] time.sleep(0.5) section 11.3.2
Use the side view to relate the camera’s QR-code detection path to the servo arm’s snack-pushing position. section 11.3
