from machine import Pin, I2C
from i2c_lcd import I2cLcd
from bmp180 import BMP180
import utime
i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
I2C_ADDR = 0x27
lcd= I2cLcd(i2c, I2C_ADDR, 2, 16)
i2c_bmp = I2C(1, scl=Pin(3), sda=Pin(2), freq=100000)
lcd.clear()
lcd.putstr("Starting...")
utime.sleep(2)
bmp = BMP180(i2c_bmp)
utime.sleep(2)
while True:
temp, pressure = bmp.read()
lcd.clear()
lcd.move_to(0, 0)
lcd.putstr("Temp:{:.1f} C".format(temp))
lcd.move_to(0, 1)
lcd.putstr("Pres:{:.0f}hPa".format(pressure))
utime.sleep(1)