Skip to content

Commit ff67a72

Browse files
authored
Create hot.py
Program for controlling the Heating Element
1 parent 98eb1fb commit ff67a72

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Make_It_Hot_Cold/hot.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import time
2+
from adafruit_crickit import crickit
3+
4+
print("Heating Pad Demo")
5+
6+
# For signal control, we'll chat directly with seesaw
7+
ss = crickit.seesaw
8+
TMP36 = crickit.SIGNAL1 # TMP36 connected to signal port 1 & ground
9+
POT = crickit.SIGNAL8 # potentiometer connected to signal port 8 & ground
10+
11+
heating_pad = crickit.dc_motor_2
12+
13+
while True:
14+
15+
voltage = ss.analog_read(TMP36) * 3.3 / 1024.0
16+
tempC = (voltage - 0.5) * 100.0
17+
tempF = (tempC * 9.0 / 5.0) + 32.0
18+
19+
heat_value = ss.analog_read(POT) / 1023.0
20+
21+
print((tempF, heat_value))
22+
23+
heating_pad.throttle = heat_value # set heat value to Motor throttle value
24+
25+
time.sleep(0.25)

0 commit comments

Comments
 (0)