Hi everyone!
Did someone know how to send 2 arrays to Raspberry with Java. I tried with this code but I am receiving just the first array 2 times.I can not send more than 32 bytes at one time. Thanks in advance!
Slave:
#include <Wire.h>
#define SLAVE_ADDRESS 0x5 // Slave board with adress 0x5
void setup() {
// initialize i2c as slave
Wire.begin(SLAVE_ADDRESS);
// define callbacks for i2c communication
Wire.onRequest(sendData);
Serial.begin(9600);
}
void loop() {
}
void sendData() {
byte buf1[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,
17,18,19,20,21,22,23,24,25,26};
byte buf2[] ={27,28,29,30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,50,51,52};
Wire.write (buf1, sizeof (buf1));
Wire.write (buf2, sizeof (buf2));
}