code.py
 1  # SPDX-FileCopyrightText: 2018 Anne Barela for Adafruit Industries
 2  #
 3  # SPDX-License-Identifier: MIT
 4  
 5  import time
 6  import board
 7  import audioio
 8  import audiocore
 9  from adafruit_crickit import crickit
10  
11  print("Cat Feeder")
12  
13  feed_servo = crickit.servo_1
14  
15  # audio output
16  cpx_audio = audioio.AudioOut(board.A0)
17  f = open("activate.wav", "rb")
18  wav = audiocore.WaveFile(f)
19  
20  while True:
21      if crickit.touch_1.value:
22          time.sleep(0.1)
23          cpx_audio.play(wav)
24          feed_servo.angle = 180
25          time.sleep(0.2)
26          feed_servo.angle = 0
27          time.sleep(0.1)