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 (IDE 2):
C:\Users\{username}\AppData\Local\Arduino15\packages\arduino\hardware\avr\{version}\libraries\Wire\src\Wire.h
- Windows (IDE 1.x):
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\Wire.h
- macOS:
~/Library/Arduino15/packages/arduino/hardware/avr/{version}/libraries/Wire/src/Wire.h
- Linux:
~/.arduino15/packages/arduino/hardware/avr/{version}/libraries/Wire/src/Wire.h
- Windows (IDE 2):
-
Open 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.