File tree Expand file tree Collapse file tree 1 file changed +12
-17
lines changed Expand file tree Collapse file tree 1 file changed +12
-17
lines changed Original file line number Diff line number Diff line change 11import time
22import board
33import busio
4- from adafruit_mcp9600 import MCP9600
4+ import adafruit_mcp9600
55
6- SENSOR_ADDR = 0x67
6+ # frequency must be set for the MCP9600 to function.
7+ # If you experience I/O errors, try changing the frequency.
8+ i2c = busio .I2C (board .SCL , board .SDA , frequency = 100000 )
9+ mcp = adafruit_mcp9600 .MCP9600 (i2c )
710
8- # try different frequency values if you get an i2c input/output error
9- i2c = busio .I2C (board .SCL , board .SDA , frequency = 200000 )
10-
11- try :
12- device = MCP9600 (i2c ,SENSOR_ADDR ,"K" )
13- print ("version:" , device .version )
14- while True :
15- print ((
16- device .ambient_temperature ,
17- device .temperature ,
18- device .delta_temperature
19- ))
20- time .sleep (1 )
21- except ValueError :
22- print ("MCP9600 sensor not detected" )
11+ while True :
12+ print ((
13+ mcp .ambient_temperature ,
14+ mcp .temperature ,
15+ mcp .delta_temperature
16+ ))
17+ time .sleep (1 )
You can’t perform that action at this time.
0 commit comments