Shop OBEX P1 Docs P2 Docs Learn Events
MultiCogSerialDebug need helping sending a Variable — Parallax Forums

MultiCogSerialDebug need helping sending a Variable

DgswanerDgswaner Posts: 795
edited 2007-12-29 19:48 in Propeller 1
I'm having trouble with some code and I really need to be able to see what some variables are doing. I've tried to use the Multicogserialdebug object but I can't get the syntax right to send a variable. I looked at the notes in the object comments but I still can't make heads or tails of it. can someone help me out.

debug.cprintf(string("DIRECTION %s\r"),RANGE,false) is what I have the %s is just the last thing I tried. from what I understand this should display "DIRECTION ### [noparse][[/noparse]RETURN]"

### being the value of the Range VAR. and [noparse][[/noparse]RETURN] being a well a return.
all I'm getting is "DIRECTION "

any text I send shows up. just not vars.

Thanks for any help

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"A complex design is the sign of an inferior designer." - Jamie Hyneman, Myth Buster

DGSwaner

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-12-28 08:49
    If RANGE is a value, eg. byte, word or long, then you must use
    one of the integervalue format specifiers: %d(=%i),%b,%o,%u,%x
    If RANGE is a character, eg. "A", and you want to print the character, use %c
    If RANGE is a null terminated byte buffer, you must use %s, but specify @RANGE
    as cprintf in that case expects an address.

    regards peter
  • DgswanerDgswaner Posts: 795
    edited 2007-12-29 19:48
    wow that was too easy all I had to do was add a %d and it worked.. I swear I tried that tho.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "A complex design is the sign of an inferior designer." - Jamie Hyneman, Myth Buster

    DGSwaner
Sign In or Register to comment.