Chilled Drinkibot for Trinket M0 controlling a peltier cooler (pump
code not implemented yet)
This commit is contained in:
parent
991fa23c17
commit
9da76ca449
1 changed files with 33 additions and 0 deletions
33
Chilled_Drinkibot/main.py
Normal file
33
Chilled_Drinkibot/main.py
Normal 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
|
||||
Loading…
Reference in a new issue