reading ASCII coded Hexadecimal data from serial port

AfRo's icon

Hi,

I'm trying to get (and numerical manipulate) hexadecimals from my serial object. Everything is working fine, but I can't manipulate the hex symbols after I've used the itoa object.

I'm getting -> error: number: doesn't understand "0x001E"

Seems like it's interpreted as a characrter

Any ideas?

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

Peter Castine's icon

First, it looks offhand like you've got a right-to-left order problem between the serial and gate objects. You may need to reread the relevant tutorial and look at the trigger object.

Second, 0x001E is not a number in Max, it's a symbol (cf the thread on 'minor confusion'). Number boxes don't grok symbols (that's tutorial, what?... 3? 4?).

Just connect serial's output (or match's output) to a number box. If you want the numbox to display in hex, use the inspector.

AfRo's icon

I think it's a bit easy to react this way. It's not about displaying the hex code, but manipulating the data. From the serial object I receive ASCII. I want to translate that to hex numbers to make calculations with.

Rutger

AfRo's icon

I think it's a bit easy to react this way. It's not about displaying the hex code, but manipulating the data. From the serial object I receive ASCII. I want to translate that to hex numbers to make calculations with.

Rutger

Emmanuel Jourdan's icon

On 14 juin 07, at 09:12, Rutger wrote:

> I think it's a bit easy to react this way. It's not about
> displaying the hex code, but manipulating the data. From the serial
> object I receive ASCII. I want to translate that to hex numbers to
> make calculations with.

Go to maxobjects.com, search for hex, and pick up one of the external
listed here. For example, Llong (from Peter Elsea) seems to achieve
what you want.

ej

AfRo's icon

Thanks

Peter Castine's icon

Quote: AfRo wrote on Thu, 14 June 2007 09:12
----------------------------------------------------
> I think it's a bit easy to react this way. It's not about displaying the hex code, but manipulating the data. From the serial object I receive ASCII. I want to translate that to hex numbers to make calculations with.

----------------------------------------------------

It is a common misconception to think that ASCII and Hex numbers and Decimal numbers are different.

They are not.

They are different visual representations of the *same thing*, used for some presumed human convenience. But a number is a number is a number is a number.

ASCII is just numbers.

Gary Lee Nelson's icon

A rose is a rose is a rose...

Combining two threads. The discussion of midi input from an Arduino device
is just numbers until you attach it to something else. Pitch bend can be
used as a panner if you send the numbers to a panning object.

I once reversed the sense of a sustain pedal in max [ !- 127 ] and jammed it
between the door knob and the frame to make a burglar alarm. I was on tour
when someone stole the key card to my hotel room while I was moving in. I
hooked up all my gear and programmed max to make a very loud noise if the
door was opened while I slept. The pedal would drop and send an pedal down
message to ctlin. Attached that to the switch on a metro. I was very
disappointed when no one came to rob me.

PS. What about Roland octal?

On 6/16/07 10:22 AM, "Peter Castine" wrote:

> But a number is a number is a number is a number.

Cheers
Gary Lee Nelson
Oberlin College
www.timara.oberlin.edu/GaryLeeNelson

joshua goldberg's icon

'it's just numbers' is the mantra of my parsons class. i think i
probably say it 30 times a semester.

On Jun 16, 2007, at 11:13 AM, Gary Lee Nelson wrote:

> A rose is a rose is a rose...
>
> Combining two threads. The discussion of midi input from an
> Arduino device
> is just numbers until you attach it to something else. Pitch bend
> can be
> used as a panner if you send the numbers to a panning object.
>
> I once reversed the sense of a sustain pedal in max [ !- 127 ] and
> jammed it
> between the door knob and the frame to make a burglar alarm. I was
> on tour
> when someone stole the key card to my hotel room while I was moving
> in. I
> hooked up all my gear and programmed max to make a very loud noise
> if the
> door was opened while I slept. The pedal would drop and send an
> pedal down
> message to ctlin. Attached that to the switch on a metro. I was very
> disappointed when no one came to rob me.
>
> PS. What about Roland octal?
>
> On 6/16/07 10:22 AM, "Peter Castine" wrote:
>
>> But a number is a number is a number is a number.
>
>
> Cheers
> Gary Lee Nelson
> Oberlin College
> www.timara.oberlin.edu/GaryLeeNelson
>
>
>

Gregory Taylor's icon

Quote: joshua goldberg wrote on Sat, 16 June 2007 09:46

> 'it's just numbers' is the mantra of my parsons class. i think i probably say it 30 times a semester.

Double true. It never ceases to amaze me how different the
life of a beginning Max user is if one STARTS with that
and one learns what numbers and symbols and lists and
messages are and then builds from there.

That's probably why someone put those discussions in the "Fundamentals" manual. As the Oblique Strategies say,

Always first steps