Example project · ESP32
Weather station (BME280)
A weather sensor the way drivers actually see it: the BME280 answers on the I2C bus with its real register map, and the Bosch compensation math lands exactly on the conditions you set in its Inspector. The prefilled script reads it end to end.

What's on the bench
- Battery
- BME280
- ESP32-C3
The code
This MicroPython script runs on the emulated board every boot; edit it in the Code tab.
from machine import I2C, Pin import struct i = I2C(0, scl=Pin(9), sda=Pin(8)) T1, T2, T3 = struct.unpack("<Hhh", i.readfrom_mem(0x76, 0x88, 6)) d = i.readfrom_mem(0x76, 0xF7, 8) aT = (d[3] << 12) | (d[4] << 4) | (d[5] >> 4) v1 = (aT / 16384 - T1 / 1024) * T2 v2 = (aT / 131072 - T1 / 8192) ** 2 * T3 print('temperature: %.2f C' % ((v1 + v2) / 5120))