I have problems to send Data packets from Processing to Arduino. I must transfer a two dimensional byte Array (data[25][8]) from Processing to my Arduino. By the way I have already problems to send two bytes at once. Can anybody give mi an example how to transmit large data packets?
I am really thankful for help because I try to do that now since two days without any success.
byte[25][8] is not that much of an array, 25 * 8 = 200 bytes.
You have a choice of quite a couple of techniques depending mostly on speed vs pins vs reliability.
You can just use
shiftOut to send the data.
i2c, wire.Send.
Serial.send.
The simplest way would be to use ShiftOut, and then reading the bit when you have the click pin high.
Thanks for reply.
AT the moment I send the Data's as follows:
void geddata(void){
Serial.flush();
for(int x=1; x<7; x++){
Serial.flush();
Serial.print(x, BYTE);
for(int i=0; i<4; i++){
for(int k=0; k<8; k++){
while(Serial.available()<1){
;
}
Data[((x-1)*4)+i][k]=Serial.read();
}
}
}
Serial.flush();
Serial.print(7, BYTE);
for(int k=0; k<8; k++){
while(Serial.available()<1){
;
}
Data[24][k]=Serial.read();
}
Serial.flush();
}
The problem is that the inputbuffer seams like not to be able to manage Data's larger then 40byte, (???) otherwise they get lost somewere in the sistem. So I have to send the Data packets in 7 units what makes the transaction verry slow. It takes about 130ms for the communication that can be 20ms if it were one packet. The main problem is that i try to control a led matrix with my arduino and the datatransfer should not be longer then 41ms to have 24 frame per second.
Does anybody know something about these problem?
PS: My Arduinos are NG