/ Adafruit_AD8495_Guide / code.py
code.py
1 # SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries 2 # 3 # SPDX-License-Identifier: MIT 4 # 5 import time 6 import analogio 7 import board 8 9 ad8495 = analogio.AnalogIn(board.A1) 10 11 12 def get_voltage(pin): 13 return (pin.value * 3.3) / 65536 14 15 16 while True: 17 temperature = (get_voltage(ad8495) - 1.25) / 0.005 18 print(temperature) 19 print(get_voltage(ad8495)) 20 time.sleep(0.5)