'''
实验名称：BMP280大气压强
实验平台：核桃派1B
'''

import time, board, busio, adafruit_bmp280

# 构建I2C对象，使用核桃派I2C1控制
i2c = busio.I2C(board.SCL1, board.SDA1)

# 构建BMP280对象,本实验模块I2C地址为默认的0x76.
bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c, address=0x76)

# 当地海平面标准大气压
bmp280.sea_level_pressure = 1013.25

while True:
    
    print("\nTemperature: %0.1f C" % bmp280.temperature)
    print("Pressure: %0.1f hPa" % bmp280.pressure)
    print("Altitude = %0.2f meters" % bmp280.altitude)
    
    time.sleep(1)

