From 7db6c6cc1de90e13e8e088f4f1fb135cad95fb3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Mon, 11 Jul 2022 01:33:09 +0200 Subject: [PATCH] next test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- test.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) 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