I2C is a serial communication bus able to address multiple devices along the same 2-wire bus.
Toit exposes the bus through the
import gpio import serial.protocols.i2c as i2c main: bus := i2c.Bus --sda=gpio.Pin 21 --scl=gpio.Pin 22
Each device must have a unique I2C address. The address can be found in the datasheet for the selected peripheral - it's a 7-bit integer.
In case of the Bosch BME280 sensor, the address is
The default frequency of the I2C bus is 400kHz. This can be changed at construction time as an argument to the