isReadingI2C()
[Inter Integrated Circuit]
bool isReadingI2C();Description
Checks if the I2C bus is currently reading data.
Parameters
None.
Returns
A boolean value that indicates if the I2C bus is currently reading data.
Example Code
The code initializes the I2C communication with the SDA pin connected to pin 4, the SCL pin connected to pin 5, and the address of the chip set to 0x20.
Checks if the I2C bus is currently reading data, and if it is, the code will perform a write I2C operation.
void setup() {
beginI2C(4, 5, 0x20); // initializes the I2C communication with the SDA pin connected to pin 4, the SCL pin connected to pin 5, and the address of the chip set to 0x20
}
void loop() {
if (stillOpenI2C()) { // checks if the I2C bus is still open
if (isReadingI2C()) { // checks if the I2C bus is currently reading data
writeI2C("x is "); // sends the string "x is " to the follower chip
}
}
}Notes and Warnings
This function is planned to be used with follower devices to check if
the I2C bus is currently reading data, together with the
stillOpenI2C() function.
