Any help would be appreciated.
import Adafruit_BBIO.ADC as ADC
import Adafruit_BBIO.PWM as PWM
import time
sensor_pin = 'P9_40'
red = "P8_13"
blue = "P8_19"
green = "P9_14"
PWM.start(red, 100)
PWM.start(blue, 100)
PWM.start(green, 100)
count = 0
ADC.setup()
PWM.cleanup()
while True:
reading = ADC.read(sensor_pin)
millivolts = reading * 1800 # 1.8V reference = 1800 mV
temp_c = (millivolts - 500) / 10
temp_f = (temp_c * 9/5) + 32
PWM.start(green, 100) # reset green light off
PWM.start(red, 100) # reset red light off
PWM.start(blue,100) # reset blue light off
count = count + 1
if temp_f < 82:
print('Normal Temp -- (COUNT=%d) Celcius=%d; Fahrenheit=%d' % (count, temp_c, temp_f))
PWM.start(green, 0)
else:
print('DANGER -- TOO HOT (COUNT=%d) Celcius=%d; Fahrenheit=%d' % (count, temp_c, temp_f))
PWM.start(red, 0)
time.sleep(1)