Create code.py

Initial code for the cat treat dispenser guide
This commit is contained in:
Mike Barela 2018-09-05 19:37:46 -04:00 committed by GitHub
parent ef9aa64c8f
commit a435200285
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,22 @@
import time
import board
import audioio
from adafruit_crickit import crickit
print("Cat Feeder")
feed_servo = crickit.servo_1
# audio output
cpx_audio = audioio.AudioOut(board.A0)
f = open("activate.wav", "rb")
wav = audioio.WaveFile(f)
while True:
if crickit.touch_1.value:
time.sleep(0.1)
cpx_audio.play(wav)
feed_servo.angle = 180
time.sleep(0.2)
feed_servo.angle = 0
time.sleep(0.1)