Create hot.py

Program for controlling the Heating Element
This commit is contained in:
Mike Barela 2018-08-23 13:24:30 -04:00 committed by GitHub
parent 98eb1fb24a
commit ff67a72287
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

25
Make_It_Hot_Cold/hot.py Normal file
View file

@ -0,0 +1,25 @@
import time
from adafruit_crickit import crickit
print("Heating Pad Demo")
# For signal control, we'll chat directly with seesaw
ss = crickit.seesaw
TMP36 = crickit.SIGNAL1 # TMP36 connected to signal port 1 & ground
POT = crickit.SIGNAL8 # potentiometer connected to signal port 8 & ground
heating_pad = crickit.dc_motor_2
while True:
voltage = ss.analog_read(TMP36) * 3.3 / 1024.0
tempC = (voltage - 0.5) * 100.0
tempF = (tempC * 9.0 / 5.0) + 32.0
heat_value = ss.analog_read(POT) / 1023.0
print((tempF, heat_value))
heating_pad.throttle = heat_value # set heat value to Motor throttle value
time.sleep(0.25)