diff --git a/test.py b/test.py index 496fcee..272d4cd 100644 --- a/test.py +++ b/test.py @@ -3,15 +3,27 @@ import busio import adafruit_bmp280 import time -def get_temperature(): - i2c = busio.I2C(board.SCL, board.SDA) - bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c, address=0x03) - return bmp280.temperature +# def get_temperature(): +# i2c = busio.I2C(board.SCL, board.SDA) +# bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c, address=0x03) +# return bmp280.temperature +count = 3 +i2c = busio.I2C(board.SCL, board.SDA) 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) + # global GPIO # import RPi.GPIO as GPIO # import time