>>> exit()
Enter the following command to create a new files called tmp36.py
nano tmp36.py
import Adafruit_BBIO.ADC as ADC import time sensor_pin = 'P9_40' 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)
To start the program, enter the command:
python tmp36.py
mv=757 C=25 F=78 mv=760 C=26 F=78 mv=762 C=26 F=79 mv=765 C=26 F=79 mv=763 C=26 F=79 mv=763 C=26 F=79 mv=766 C=26 F=79 mv=768 C=26 F=80