Chilled Drinkibot for Trinket M0 controlling a peltier cooler (pump

code not implemented yet)
This commit is contained in:
John Edgar Park 2017-10-26 07:29:51 -07:00
parent 991fa23c17
commit 9da76ca449

33
Chilled_Drinkibot/main.py Normal file
View file

@ -0,0 +1,33 @@
# Chilled Drinkibot
from digitalio import DigitalInOut, Direction, Pull
import board
import time
led = DigitalInOut(board.D2) # Button LED
led.direction = Direction.OUTPUT
button = DigitalInOut(board.D0)
button.direction = Direction.INPUT
button.pull = Pull.UP
chiller = DigitalInOut(board.D3) # Pin to control the chiller and fan
chiller.direction = Direction.OUTPUT
pump = DigitalInOut(board.D4) # Pin to control the pump
chillTime = 10 # How many seconds of cooling
pumpTime = 5 # How many seconds of pumping
while True:
# we could also just do "led.value = not button.value" !
if button.value:
led.value = False
chiller.value = True
time.sleep(chillTime)
else:
led.value = True
chiller.value = False
time.sleep(0.01) # debounce delay