Newbie question about Serin and loops
NewJerseyTN
Posts: 14
If I have a serin in a loop does execution stop at the serin until a byte is on the pin the serin is looking at?· What I'm hoping is that it doesn't and it just continues to the rest of the code.
Comments
Execution does stop until one of two things occurs. One is that the SERIN criteria is satisfied, or two, the timeout period has expired.
Satisfying the SERIN critera may mean matching particular specified characters, or accepting a specified number of digits or an EOD indication (i.e. carraige return).
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
On the good side, it can SERIN on any I/O pin. On the bad side, only one at a time.
Get a byte from my PocketPC
If a byte was sent set a varible to that byte
depending on the varible move a servo to a setpostion + an additional small random number
get a new random number
loop back to getting a byte from the PocketPC
I don't want the stamp to sit waiting for data from the PocketPC. I want it to go on updating that random number and making small movements in the servo. But when data is there I want it to get it.
Well, that's why I have the varible that I'm setting the BYTE from serin to. As long as that varible isn't updated by the serin it should stay the same and the servo will get an updated signal in the loop after the serin call. Also I'm thinking of getting the serial servo controler from Parallax anyway. I believe it keeps a constant signal to the servo. I've looked at the help again on serin and the timeout parameter looks like just what the doctor ordered.
Yeah, a returned zero will be fine because the data I'm going to get from the PocketPC isn't going to be positional, more of an action to take. So I'm going to have the PocketPC send a character for "forward" and let the basic stamp handle what the right position for "forward" is.