The Wire library is used to communicate with I2C/TWI devices. Being able to change/modify it’s buffer size is very useful for I2C/TWI device communication.
To locate the Wire.h
library in the Arduino installation path and modify its buffer size, take the steps outlined below:
-
Close the Arduino IDE if open.
-
Find the file
Wire.h
:- Windows:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\Wire.h
- macOS:
~/Library/Arduino15/hardware/arduino/avr/libraries/Wire/src/Wire.h
- Linux:
~/sketchbook/hardware/arduino/avr/libraries/Wire/src/Wire.h
- Windows:
-
Opem the file
Wire.h
with a text editor. -
Locate the line
#define BUFFER_LENGTH 32
and change the number32
to the desired value. -
Save the changes made and close the text editor.
-
Restart the IDE.