Skip to content

Commit

Permalink
PID Control
Browse files Browse the repository at this point in the history
Added LED indicator for temperature
  • Loading branch information
APMonitor authored Sep 23, 2017
1 parent 743d778 commit 904b604
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions 4_PID Control/arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ def readTemp(self):
voltage = float(val) * (3300.0/1024.0)
degC = (voltage - 500.0)/10.0
degK = degC + 273.15
# LED Temperature indicator
pin = 9 # for LED
led_level = int(2.0 * (degK - 300.0))
led_level = min(max(0,led_level),250) # clip
cmd_str = self.build_cmd_str("aw", (pin, led_level))
try:
self.sr.write(cmd_str.encode())
self.sr.flush()
except:
pass
return degK

def writeVoltage(self,mV):
Expand Down

0 comments on commit 904b604

Please sign in to comment.