parent
199bdac5f9
commit
7db6c6cc1d
22
test.py
22
test.py
|
@ -3,15 +3,27 @@ import busio
|
||||||
import adafruit_bmp280
|
import adafruit_bmp280
|
||||||
import time
|
import time
|
||||||
|
|
||||||
def get_temperature():
|
# def get_temperature():
|
||||||
i2c = busio.I2C(board.SCL, board.SDA)
|
# i2c = busio.I2C(board.SCL, board.SDA)
|
||||||
bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c, address=0x03)
|
# bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c, address=0x03)
|
||||||
return bmp280.temperature
|
# return bmp280.temperature
|
||||||
|
|
||||||
|
count = 3
|
||||||
|
i2c = busio.I2C(board.SCL, board.SDA)
|
||||||
while True:
|
while True:
|
||||||
print(get_temperature())
|
if count != 77:
|
||||||
|
try:
|
||||||
|
bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c, address=hex(count))
|
||||||
|
print(bmp280.temperature)
|
||||||
|
exit()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
exit()
|
||||||
|
# print(get_temperature()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
# global GPIO
|
# global GPIO
|
||||||
# import RPi.GPIO as GPIO
|
# import RPi.GPIO as GPIO
|
||||||
# import time
|
# import time
|
||||||
|
|
Loading…
Reference in New Issue