Arduino Wire.h Library

Let's use an LED driver like the PCA9685 as an example. The PCA9685 uses the I2C protocol to control the LEDs.

void receiveEvent(int bytes) while(Wire.available()) char c = Wire.read(); Serial.print(c); arduino wire.h library

This is the "Grand Illusion" of Arduino. It makes the complex feel trivial. Let's use an LED driver like the PCA9685 as an example

Sending data is one thing; asking for it is another. The Wire.requestFrom() function is the library’s most sophisticated routine. arduino wire.h library

Wire.requestFrom(0x68, 6); // Ask device 0x68 for 6 bytes