User Manual
touch_vals = (seesaw.touch_read(0), seesaw.touch_read(3))
# print(touch_vals)
touch1 = False
if seesaw.touch_read(0) > 500:
touch1 = True
if touch1 != last_touch1:
if touch1:
start_angle = my_servo.angle
end_angle = start_angle - 20
end_angle = max(0, min(end_angle, 180))
print("left from", start_angle, "to", end_angle)
for a in smooth_move(start_angle, end_angle, 25):
my_servo.angle = a
time.sleep(0.03)
last_touch1 = touch1
touch4 = False
if seesaw.touch_read(3) > 500:
touch4 = True
if touch4 != last_touch4:
if touch4:
start_angle = my_servo.angle
end_angle = start_angle + 20
end_angle = max(0, min(end_angle, 180))
print("right from", start_angle, "to", end_angle)
for a in smooth_move(start_angle, end_angle, 25):
my_servo.angle = a
time.sleep(0.03)
last_touch4 = touch4
if buttona.value != last_buttona:
if buttona.value:
print("down")
if motor_a.throttle:
print("haulin!")
motor_b.throttle = -0.1
else:
motor_b.throttle = -0.1
else:
motor_b.throttle = 0
last_buttona = buttona.value
if buttonb.value != last_buttonb:
if buttonb.value:
print("up")
if motor_a.throttle:
print("haulin!")
motor_b.throttle = 0.4
else:
motor_b.throttle = 0.3
else:
motor_b.throttle = 0
last_buttonb = buttonb.value
if switch.value != last_switch:
motor_a.throttle = switch.value
if motor_a.throttle:
print("GRAB")
© Adafruit Industries
https://learn.adafruit.com/adafruit-crickit-creative-robotic-interactive-
construction-kit
Page 159 of 201










