How can I convert groups of incoming bytes received via serial to a singel int.

edited October 2015 in Library Questions

Hi,

I am using processing to communicate via serial with a fingerprint sensor (GT-511C3) and the messages it sends looks something like this: 55-AA-01-00-0F-10-00-00-31-00-50-01.

as these are sent separately and constantly I cannot in this state listen for a specific byte changing (e.g. the 0F changing to 00) so I would like to convert these sets of bytes to ints so that I can use them to trigger specific events.

Any idea of how I would go about to do that would be much appreciated.

here is the code Im using to receive them:

void serialEvent(Serial p) { byte rx_byte;

while (p.available() > 0) { // get a single character from the serial port rx_byte = (byte)serial_port.readChar(); println(hex(rx_byte)); } }

Thanks!

Answers

Sign In or Register to comment.