To set master mode when starting I2C by i2c.start(), specify master for mode and specify communication frequency. The frequency is generally 100kHz or 400kHz in I2C.
The pull-up with a "small" resistor is needed to communicate at high speed. The setting is as shown below to use I2C with only internal pull-up without an external resistor, although this is not recommended.
i2c.write() sends data to device, using addresses and array data. In the program below, the address is 0x50. If writing fails, such as when the connection is not established with the other party, or when other party refuses (NAK), the function set in onerror.
i2c.readWait() reads data from the device. Set the length of data to read along with the address of the other device. When reading successfully done, it returns data, of which the length is as specified. In case of communication error, error will be thrown