any2bytes from moocow On Tue, May 5, 2015 at 12:43 AM, Derek Holzer <[email protected]> wrote:
> 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 > > -- > derek holzer > noise.art.technology > http://macumbista.net > > _______________________________________________ > [email protected] mailing list > UNSUBSCRIBE and account-management -> > http://lists.puredata.info/listinfo/pd-list >
_______________________________________________ [email protected] mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
