I have a MCP 4725 D to A sensor connected to my Redboard Plus. Using the example code from the sensor description, I can create a sinewave output signal. The frequency of the sinewave is about 4.5 Hz, which equates to a I2C speed of about 100 kHz. Is there a way to change the bus speed to the “fast” from “standard” ?
Sure - just set it in the sketch/example using the Wire.setClock() function:
The easiest way to set the I2C bus speed is by using the Wire.setClock() function provided by the Wire library. Add this function after Wire.begin() in your setup code:
void setup() {
Wire.begin();
Wire.setClock(400000); // Set I2C speed to 400 kHz (fast mode)
}