Serial Object.....How to Send Integer as Byte?

ella_guru's icon

I have just started playing around with Max and am so far very impressed.
My application involves analyzing a MIDI stream and then outputting to a micro controller (right now, I'm using a Basic Stamp.....will eventually migrate to Parallax Propeller).

Everything is going well, apart from when Max sends the data it seems to send it as the ASCII value rather than the actual byte value (e.g. The ASCII code for 5 is 53, so the byte representation of 53 (Binary: 00110101) is sent instead of the byte representation for the number 5 (00000101) )

Similarly, if I had a 2 digit number (e.g. 65) it seems to be sent as two bytes (6 & 5).

I've checked around online without success for some object that will convert an integer to a byte (all my values will be less than 255) prior to sending it over the serial connection.
Anybody have any suggestions?

Thanks

ygreq's icon

you did use a number box with binary number, right?

Max Patch
Copy patch and select New From Clipboard in Max.

ella_guru's icon

No. I did not, didn't realize that you could do that. Thank you, this is exactly what I was looking for.

ygreq's icon

You're welcome!