Shop OBEX P1 Docs P2 Docs Learn Events
Strings in spin with dec values — Parallax Forums

Strings in spin with dec values

nomadnomad Posts: 276
edited 2009-08-25 17:33 in Propeller 1
hi
i have a questions
i am working with the PPDB and the RS232-connection to a linux-box
the questions is:
>>
on the BS2-BOE it's possible to send a String (for the Linux Box)
as:
DEBUG "$",DEC3 angle,":",DEC schalt1,":",DEC schalt2,":",DEC pirF_1,":",DEC irB_1,":",CR

is this with the propeller and in spin possible????

>> Serial.str(String("$") Serial.dec(angle) Serial.str(String(":") Serial.dec(schalt1)
Serial.str(String(":") Serial.dec(schalt2) Serial.str(String(":")
Serial.dec(pirF_1) Serial.str(String(":") Serial.dec(irB_1) Serial.str(String(":")
Serial.SetDelimiter(13)

PUB dec(value)
'' See FullDuplex Serial Documentation
'' Serial.dec(1234) ' send decimal value as chracters
ExtSerial.dec(value)

thanks for hints and tips.
regards
nomad

Post Edited (nomad) : 8/24/2009 12:38:03 PM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-08-24 12:51
    Yes, you use Serial.dec(1234) as you've shown. Remember that you need matching parentheses like Serial.str(String("$"))

    You do need to have OBJ Serial : "FullDuplexSerial" declared in your program
  • nomadnomad Posts: 276
    edited 2009-08-25 07:32
    hi mike
    thank you verry much for your tips and help
    regards nomad
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-08-25 17:33
    One thing I've never been able to figure out is why every output object has to provide its own dec and hex methods, when Jeff's Numbers and Chip's Simple Numbers objects perform these conversions so elegantly. It would seem that the only output methods necessary for any such communications object would be out (single-character) and str (string).

    -Phil
Sign In or Register to comment.