De Funct
Published © CC BY-SA

TMP36 and Recording

I have been working out of a book and I thought of adding some extra oomph.

BeginnerWork in progress2 hours1,113
TMP36 and Recording

Things used in this project

Story

Read more

Code

Some software...

Python
It is good!
import Adafruit_BBIO.ADC as ADC
import time
 
sensor_pin = 'P9_39'
 
ADC.setup()

with open('loveAndTemp.txt', 'w') as file:
    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))
        file.write('mv=%d C=%d F=%d \n' % (millivolts, temp_c, temp_f)
        time.sleep(1)

Credits

De Funct

De Funct

3 projects • 16 followers
Stay there and someone will find you...

Comments