Hi all,
I did a search or two, but did not find anything definitive. Can someone point me to a link, or explain the fastest method I can read bytes from a byte array, as ints, so that they will have unsigned values (0 to 255), as opposed to the normal -128 to 127? Is there some simple bit shifting technique that will do this?
Are there any other datatypes that will work in Processing without adding a library etc.?
Is there a way to specify a type in Processing, similar to what there is in C, as in "uint8_t" or "uint16_t" ?
I keep having to invent work-arounds for clashing datatypes between Arduino and Processing. char isn't really working out very well as a numerical. I realize it is not meant to be a numerical type, so is there a 16 bit, unsigned type? Or even a 16 bit signed? I could also really, really use an 8 bit unsigned type as well, if that exists.
32 bits is overkill for what I'm doing, and I could cut the serial transfer time down a lot if I could work with smaller types.
I'm new to Processing, so maybe there is something obvious that I'm missing.
I'm writing a sketch where I need it to wait for serial data or single-key input from the keyboard.
I'm using a while loop to wait for those events, but keyboard entries don't seem to register when the sketch is in the while loop.
Here's an example (ignoring the serial aspect, which seems to work fine). When I run it, it never gets out of the while loop, so it never prints "key was pressed". And, usually, the sketch locks up and I have to end java manually in task manager.