Shop OBEX P1 Docs P2 Docs Learn Events
SEROUT Command to PINK (Parallax Internet Network Kit) — Parallax Forums

SEROUT Command to PINK (Parallax Internet Network Kit)

DosEdgeDosEdge Posts: 33
edited 2007-02-06 17:37 in BASIC Stamp
I am trying to send repetitive information to the PINK.· Below is the portion that I am trying to use to do it.

The code· increments through the EEPROM (0-11) receiving the data,then sends it to the PINK's variables to be displayed in a web page through the SEROUT command through each iterations.

FOR i=0 TO 11
READ i, Update
SEROUT 0,396,[noparse][[/noparse]"!NB0Wi:",DEC Update,CLS]
DEBUG· DEC Update,CR
NEXT

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-02-05 19:41
    Try this instead:

    FOR i = 0 TO 11
      READ i, Update
      SEROUT 0, 396, [noparse][[/noparse]"!NB0W", DEC i, ":", DEC Update, CLS]
      DEBUG DEC Update, CR
    NEXT
    
    
    



    In your code, the "i" was being sent as a literal, rather than a value.

    -Phil
  • DosEdgeDosEdge Posts: 33
    edited 2007-02-05 23:32
    Phil Pilgrim

    The code does not transfer the content in the EEPROM to the PINK. Instead, it sends the loop iteration value. I declared all PINK's variable in the html <Nb_var0> - <Nb_var11>. I receive the results 0 0. Think I will have to hardcode the program with twelve SEROUT commands to send the content to each of the PINK variable using a modulus position inside a for loop.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-02-05 23:55
    I just referred to the manual, and it looks like the leading zero in the variable designator is necessary. So try this instead:

    FOR i = 0 TO 11
      READ i, Update
      SEROUT 0, 396, [noparse][[/noparse]"!NB0W", DEC2 i, ":", DEC Update, CLS]
      DEBUG DEC Update, CR
    NEXT
    
    
    


    Trust me: you won't have to hard code anything. The loop will work.

    -Phil
  • DosEdgeDosEdge Posts: 33
    edited 2007-02-06 00:03
    PhilPhi, Can you explain to me what is going on inside the brackets?
  • DosEdgeDosEdge Posts: 33
    edited 2007-02-06 01:19
    PhilPi
    FOR·i·=·0·TO·11
    ··READ·i,·Update
    ··SEROUT·0,·396,·[noparse][[/noparse]"!NB0W",·DEC2·i,·":",·DEC·Update,·CLS]
    ··DEBUG·DEC·Update,·CR
    NEXT


    DEC2 formatter designate that value of i sould be two digits.· Once I hardcode the twelve variables in the html page, will the BS2 use the loop with the SEROUT command to send the content of twelve positions in the EEPROM (0-11) to the those twelve variables in the html page.· Why did you separate the command in the brackets?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-02-06 01:48
    If you want to see firsthand what the formatting does, try this:

    DEBUG CR
    FOR i = 0 TO 11
      READ i, Update
      SEROUT 16, 84, [noparse][[/noparse]"!NB0W", DEC2 i, ":", DEC Update, CR]
    NEXT
    
    
    


    This will print the same data to the debug window that the PINK would see, except that each line ends with a CR, rather than a CLS, so you can see all the output. Hopefully, seeing it in action will make everything clear.

    -Phil
  • DosEdgeDosEdge Posts: 33
    edited 2007-02-06 02:13
    Phil Pilgrim I do not have access to the internet at home, so I will go examine the example that you have given me. If I have any other questions. I will PM to ask or not I will continue with this post.

    Thank You for your help so far,

    DosEdge
  • DosEdgeDosEdge Posts: 33
    edited 2007-02-06 16:57
    The code works PhilPi! Thank you so much! Do you have any experience with the SLEEP command and the DS1620 thermometer sensor?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-02-06 17:37
    Please start a new thread for a different subject. Thanks!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.