serin?
Hward
Posts: 8
Trying to learn how to use serin,·· I have a little vb program writen that is just sending out a number when some thing is clicked.· Right now I am just trying to recieve the serial data on my bs2 and debug it but am not having any luck really·· I know its hooked up right.·· I have gotten it to work with this code.
loop:
SERIN 1,16572,[noparse][[/noparse]WAIT ("1")]
DEBUG "1"
PAUSE 500
DEBUG CLS
GOTO loop
But I don't want it to really wait just debugs what ever number comes in
·
loop:
SERIN 1,16572,[noparse][[/noparse]WAIT ("1")]
DEBUG "1"
PAUSE 500
DEBUG CLS
GOTO loop
But I don't want it to really wait just debugs what ever number comes in
·
Comments
Once you have the data in a variable (defined to be the right size, of course), you can display it with the DEBUG command. Right now, you are just displaying the literal "1", waiting for half of a second, clearing the screen and repeating the process.
Hope this helps.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truly Understand the Fundamentals and the Path will be so much easier...
serData·· VAR··· Word
loop:
SERIN 1,16572,[noparse][[/noparse]serData]
IF serData = "1" THEN MoveUp
IF serData = "2" THEN MoveDown
IF serData = "3" THEN MoveRight
IF serData = "4" THEN MoveLeft
GOTO loop
Main:
· DO
··· DO
···· ·SERIN Sin, Baud, [noparse][[/noparse]cmd]
···· ·LOOKDOWN cmd, [noparse][[/noparse]"1234"], cmd
····LOOP UNTIL (cmd <= 3)
··· ON cmd GOSUB Move_Up, Move_Dn, Move_Rt, Move_Lf
· LOOP
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax