.. highlight:: python I2C === The Inter-Integrated Circuit (I2C) Protocol is a protocol intended to allow multiple "peripheral" digital integrated circuits ("chips") to communicate with the MetaWear board. The I2C module allows you to directly communicate with a sensor via the I2C bus. If you want to add sensors to the MetaWear board that communicate with I2C, this is possible using the I2C module. I2C functions are defined in the `i2c.h `_ header file. Data Signal ----------- I2C data signals are retrieved by calling `mbl_mw_i2c_get_data_signal `_. You will need to pass two parameters: * Length variable that sets how many bytes the signal is expected to receive * An unique ID identifying the signal If the id value has already been used, the length parameter will be ignored and the previously created signal will be returned. :: signal = self.libmetawear.mbl_mw_i2c_get_data_signal(board, 1, 0xa) Read ---- To read I2C data, use the `mbl_mw_datasignal_read_with_parameters `_ function with the parameters set by the `MblMwI2cReadParameters `_ struct. :: parameters= I2cReadParameters(device_addr= 0x1c, register_addr= 0xd) signal = libmetawear.mbl_mw_i2c_get_data_signal(self.board, 1, 0xa) libmetawear.mbl_mw_datasignal_read_with_parameters(signal, byref(parameters)) :: def data_handler(self, ctx, data): print("%s -> %s" % (self.device.address, parse_value(data))) sensor_data_handler = FnVoid_VoidP_DataP(data_handler) signal = libmetawear.mbl_mw_i2c_get_data_signal(board, 1, 0xa) libmetawear.mbl_mw_datasignal_subscribe(signal, None, sensor_data_handler) Write ----- Writing data through the I2C bus is handled with the `mbl_mw_i2c_write `_ function. :: libmetawear.mbl_mw_i2c_write(board, deviceAddress, registerAddress, array, length)