We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi
I've create a UDP server in a raspberry and with an array I send the state of my interruptor "1"or"0" but how to receive this array in processing ?
after my programme need to go in android mode
thanks
Answers
Have you searched UDP in the libraries page?
I've find this code
void receive( byte[] data ) { // <-- extended handler
println("recu !!"); for (int i=0;i<data.length;i++) print(data[i]); println(); if (data[i]==10000000) println(allumer); }
i receive a binary code in 8 bytes and when i compile my programme i have an error "can not find anything named i" for the line if (data[i]==10000000)
http://forum.processing.org/two/discussion/8045/how-to-format-code-and-text
The variable i is defined only for the loop. When the loop ends, the variable "disappears". Even if was still visible, it would have the value of data.length, so it would throw an ArrayIndexOutOfBoundsException...
You can replace this line with: