Hi, I have been driven mad by the following problem in my first ever Processing + arduino project.
[u]Project:[/u] Basically I am trying to send as many analog.read data from the arduino via the USB to Processing to display them on a MacBook, kind of a poor-man's scope application. In order not to limit my sampling by the speed of the serial port, I want to acquire an array of 2byte words (10bit per ADC sample) as quickly as the ADC settling time allows and then push the array through the serial port to the Mac. When that is done, the next ADC burst of data will be acquired, transferred, displayed and so on...
[u]Problem:[/u] The interpretation of all primitive data types (integer, byte) is different on the two platforms. In Processing integers are 4 bytes and bytes are signed, while on the arduino the integers are 2 bytes and bytes are unsigned. I could move to char or strings, but that is rather inefficient in terms of effective data rates - I think my burst rate would suffer a factor of 2 slow down.
[u]Summary:[/u]If you have written an efficient way to transfer 10bit output from the ADC to Processing please let me know.
Many thanks for reading!