Shop OBEX P1 Docs P2 Docs Learn Events
Storing Multiple Characters in a Variable — Parallax Forums

Storing Multiple Characters in a Variable

MikerocontrollerMikerocontroller Posts: 310
edited 2008-08-09 04:37 in BASIC Stamp
· I'm using the HB-55B Compass Module and it works fine so far.· The trouble I'm having is trying to store the
compass cardinal readings ("N","NW","S","SW",etc..) in a Word-sized variable.· How do I store a character string?
····· ·Thank-You.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-09 03:13
    You could do: v = "W" << 8 + "N" or v = " " << 8 + "N"

    It's not really a character string, but it is two characters.
    You could treat it as a two byte array and use the STR formatter like:
    SEROUT <pin>,<Baud>,[noparse][[/noparse] STR v\2 ]
    I think this'll work.
  • MikerocontrollerMikerocontroller Posts: 310
    edited 2008-08-09 04:37
    Thank-you Mike. Always helpful....
Sign In or Register to comment.