Skip to content

Commit 36b294c

Browse files
authored
Merge pull request #317 from adafruit/TheKitty-patch-20
Create code.py
2 parents ef9aa64 + a435200 commit 36b294c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Cat_Treat_Dispenser/code.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import time
2+
import board
3+
import audioio
4+
from adafruit_crickit import crickit
5+
6+
print("Cat Feeder")
7+
8+
feed_servo = crickit.servo_1
9+
10+
# audio output
11+
cpx_audio = audioio.AudioOut(board.A0)
12+
f = open("activate.wav", "rb")
13+
wav = audioio.WaveFile(f)
14+
15+
while True:
16+
if crickit.touch_1.value:
17+
time.sleep(0.1)
18+
cpx_audio.play(wav)
19+
feed_servo.angle = 180
20+
time.sleep(0.2)
21+
feed_servo.angle = 0
22+
time.sleep(0.1)

0 commit comments

Comments
 (0)