User Manual
startfile = "startup.wav"
loopfile = "loop.wav"
with open(startfile, "rb") as f:
wav = audioio.WaveFile(f)
a.play(wav)
for _ in range(3):
IR_Command(Calibrate)
time.sleep(0.5)
while a.playing:
IR_Command(Open)
time.sleep(1)
IR_Command(Close)
time.sleep(1)
f = open(loopfile, "rb")
wav = audioio.WaveFile(f)
a.play(wav, loop=True)
while True: # Main Loop poll switches, do commands
led.value = switch.value # easily tell if we're running
if not switch.value:
continue
#touch_vals = (touch2.raw_value, touch3.raw_value, seesaw.touch_read(0), seesaw.touch_read(1),
# seesaw.touch_read(2), seesaw.touch_read(3))
#print(touch_vals)
if touch2.raw_value > 3000:
print("Open jaws")
pixels.fill((50,50,0))
IR_Command(Open) # Button A opens arms
elif touch3.raw_value > 3000:
print("Close jaws")
pixels.fill((0,50,0))
IR_Command(Close) # Button B closes arms
elif seesaw.touch_read(0) > CAPTOUCH_THRESH:
print("Up")
pixels.fill((50,0,50))
IR_Command(Up)
elif seesaw.touch_read(1) > CAPTOUCH_THRESH:
print("Down")
pixels.fill((50,50,50))
IR_Command(Down)
elif seesaw.touch_read(2) > CAPTOUCH_THRESH:
print("Left")
pixels.fill((50,0,0))
IR_Command(Left)
elif seesaw.touch_read(3) > CAPTOUCH_THRESH:
print("Right")
pixels.fill((0,0,50))
IR_Command(Right)
time.sleep(0.1)
pixels.fill((0,0,0))
© Adafruit Industries
https://learn.adafruit.com/adafruit-crickit-creative-robotic-interactive-
construction-kit
Page 146 of 201










