|
楼主 |
发表于 2020-6-24 09:30
|
显示全部楼层
[mw_shl_code=arduino,true]#MicroPython动手做(34)——通用传感器的综合运用
#BMP280气压温度传感器
from mpython import *
import music
import time
music.play('D5:1')
rgb[1] = (int(0), int(102), int(0))
rgb.write()
time.sleep_ms(1)
while True:
oled.fill(0)
oled.DispChar("气压温度计", 0, 0, 1)
oled.DispChar((''.join([str(x) for x in ["温度:", round(bme280.temperature(), 1), " 度"]])), 0, 15, 1)
oled.DispChar((''.join([str(x) for x in ["湿度:", round(bme280.humidity(), 1), " %"]])), 0, 30, 1)
oled.DispChar((''.join([str(x) for x in ["气压:", round(bme280.pressure(), 1), " 帕"]])), 0, 45, 1)
oled.show()
time.sleep(2)[/mw_shl_code]
|
|