Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Adafruit_BBIO.ADC as ADC
- import time
- sensor_pin = 'P9_39'
- ADC.setup()
- 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
- print('mv=%d C=%d F=%d' % (millivolts, temp_c, temp_f))
- time.sleep(1)
- if True:
- file = open('/home/debian/loveAndTemp.txt', 'w')
- file.write('mv=%d C=%d F=%d ' % (millivolts, temp_c, temp_f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement