Skip to main content
1 of 2
KIIV
  • 4.8k
  • 1
  • 13
  • 21

There is no maximum length for sending/receiving in I2C. It is the Wire library BUFFER_LENGTH 32 macro, causing this limitation.

You can either copy some code from Wire library and implement your own requestFrom function which will store data directly to your cmdInStr string buffer or you can change Wire.h to have bigger BUFFER_LENGTH.

Or another way is to extend Wire.h like this:

#ifndef BUFFER_LENGTH
#define BUFFER_LENGTH 32
#endif

and in your sketch:

#define BUFFER_LENGTH 180
#include <Wire.h>

All depends on your preferences, but implementing own requestFrom and storing it directly into your cmdInStr buffer will be little bit more efficient than copying it into Wire buffer and then into your own buffer again.

KIIV
  • 4.8k
  • 1
  • 13
  • 21