Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from bmp180 import BMP180
- from machine import I2C, Pin, SoftI2C # create an I2C bus object accordingly to the port you are using
- # bus = I2C(1, baudrate=100000) # on pyboard
- # bus = I2C(scl=Pin(12), sda=Pin(35), freq=100000) # on esp8266
- bus = i2c = SoftI2C(scl=Pin(22), sda=Pin(21))
- bmp180 = BMP180(bus)
- bmp180.oversample_sett = 2
- bmp180.baseline = 101325
- from time import sleep
- from utils import myoled
- while True:
- temp = bmp180.temperature
- p = bmp180.pressure
- altitude = bmp180.altitude
- print(temp, p, altitude)
- myoled.show('Temp: ' + str(temp), 4, True)
- sleep(0.1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement