[PD] constructing ASCII messages

Cyrille Henry ch at chnry.net
Tue May 5 09:02:46 CEST 2015


hello,

you can try using "list fromsymbol" from pd vanilla version >= 0.46
(you will need to convert the float to symbol first, but that's not a big problem)

cheers
c


Le 04/05/2015 23:43, Derek Holzer a écrit :
> Hi folks. Been a while.
>
> I'm working on a project where I must construct ASCII messages to the microcontroller inside a motor.
>
> It accepts messages in the following format:
>
> NODE COMMAND ARGUMENT CARRIAGERETURN (hereafter CR)
>
> For NODE 0 V 0 CR, in ASCII that would be:
>
> 48 86 53 48 13
>
> So, using the following objects:
>
> [num\  <----ARGUMENT GIVEN HERE
> |
> [spell] <----convert number to ASCII
> |
> [list prepend 48 86] <---- NODE 0, COMMAND V
> |
> [list append 13]  <----CR
> |
> [comport]
>
> I can construct and send ASCII messages where the ARGUMENT is a single digit.
>
> All well and good when working with single digits, but the problem is that the ARGUMENT is a dynamically changing number of a variable length in ASCII characters, and I am banging my head against the keyboard trying to work out how to do this. [spell] spits out the ASCII of "666" (for example) in a sequence, rather than as a list of three elements.
>
> 54
> 54
> 54
>
> What kind of object allows me to send a variable number of arguments which could be packed into a single message without "padding" (zeros in place of "missing" arguments)? It should allow "666" to appear as "54 54 54", or "1024" to appear as "49 48 50 52", or "44100" to appear as "52 52 49 48 48", rather than as each individual element at a time.
>
> Other options using objects like [sprintf] could also be considered. I am sure I am not the only person to have this problem to solve. Thanks for your thoughts!
>
> Pls CC with replies as I am not actively monitoring the list these days.
>
> Thanks!
> Derek
>



More information about the Pd-list mailing list