Shop OBEX P1 Docs P2 Docs Learn Events
can you program PINK variable names? — Parallax Forums

can you program PINK variable names?

rhuggrhugg Posts: 14
edited 2007-11-06 18:34 in General Discussion
First week on PINK, it seems to work well.

I am trying to write values to the PINK's variables (Nb_varXX) and the following statement works fine:

SEROUT TX, Baud, [noparse][[/noparse]"!NB0W03:", DEC LightLevel, CLS]

However, i have a bunch of data, enough to fill all 100 variables. Is there any way of coding

SEROUT TX, Baud, [noparse][[/noparse]"!NB0W00:", DEC LightLevel, CLS].....SEROUT TX, Baud, [noparse][[/noparse]"!NB0W99:", DEC LightLevel, CLS]

without have to write this out 100 times?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-05 06:31
    You could a statement like this in a loop or subroutine:
    SEROUT TX,Baud,[noparse][[/noparse]"!NB0W",DEC2 v,":",DEC LightLevel,CLS]
    


    where v is the number of the variable you want to write to.
  • DgswanerDgswaner Posts: 795
    edited 2007-11-05 22:02
    SEROUT TX, Baud, [noparse][[/noparse]"!NB0W", Nbvar , ":", DEC LightLevel, CLS].....SEROUT TX, Baud, [noparse][[/noparse]"!NB0W", NbVar1 ,":", DEC LightLevel, CLS]


    where Nbvar and Nbvar1 = 00-99

    I have used this method successfully, the above line I haven't tested for syntax but you get the idea.

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

    Post Edited (Dgswaner) : 11/5/2007 10:08:35 PM GMT
  • rhuggrhugg Posts: 14
    edited 2007-11-06 15:17
    thank you gentlemen, i tried Mike's suggestion and this works very well. the project is for remote control of a propane powered generator via the internet. the generator is located in northern canada and i live in california.
  • DgswanerDgswaner Posts: 795
    edited 2007-11-06 18:02
    sorry I must of accidentally put Mike on my ignore list. I didn't even see his post. I was wondering why there were 1/2 as many posts as there were a few days ago.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    A complex design is the sign of an inferior designer. - Jamie Hyneman, Myth Buster
  • James LongJames Long Posts: 1,181
    edited 2007-11-06 18:20
    wow....I could never even think of making such a grave error.

    smile.gif

    James L
  • DgswanerDgswaner Posts: 795
    edited 2007-11-06 18:27
    I know it was like ripping out all of the even pages of a book

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    A complex design is the sign of an inferior designer. - Jamie Hyneman, Myth Buster
  • James LongJames Long Posts: 1,181
    edited 2007-11-06 18:34
    LOL....I'm sure.

    James L
Sign In or Register to comment.