next test

Signed-off-by: Ebbe Baß <ebbe@ping-mee.de>
master
Ebbe Baß 2022-07-11 01:33:09 +02:00
parent 199bdac5f9
commit 7db6c6cc1d
1 changed files with 17 additions and 5 deletions

22
test.py
View File

@ -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