×
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
from gpiozero import MCP3208
import time
Vref = 3.30
def conv_temp(volts,places):
temp = volts * 100
temp =round(temp,places)
return temp
while True:
try:
pot = MCP3208(channel=0)
v=pot.value * Vref
#print(str(pot.value * Vref) + "V")
t=conv_temp(v,4)
print("temp 0: {:8.2f}".format(t))
time.sleep(1)
except KeyboardInterrupt:
break
PR