sending 2 Arrays via I2C to Pi with Java


hi everyone!
did know how send 2 arrays raspberry java. tried code receiving first array 2 times.i can not send more 32 bytes @ 1 time. in advance!
slave:
code: [select]
#include <wire.h>
#define slave_address 0x5 // slave board adress 0x5

void setup() {
  // initialize i2c slave
  wire.begin(slave_address);

  // define callbacks 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));
}

i guess have restructure senddata() first time called, responds buf1. second time called should respond buf2. , on.


Arduino Forum > Using Arduino > Programming Questions > sending 2 Arrays via I2C to Pi with Java


arduino

Comments

Popular posts from this blog

Error compiling for board Arduino/Genuino Uno.

Installation database is corrupt

esp8266 (nodemcu 0.9) client.write très lent ???