Another simple question
hottnikks36
Posts: 8
Hello guys,
I have a question about a similar topic that i saw on these boards a few weeks ago, but sadly i cannot find that thread anymore. So sorry if i seem a bit repetitive with this question.
I'm trying to run a bit of code every 15-20 seconds. The precise measuring of time is not important.
I have a Parallax Bluetooth EB500 transceiver attached to my BS2p, and in the code, i have simple lines that say:
'status is an INPUT pin. When status = 1, that means some other Bluetooth device is connected to my EB500
WaitForConnection:
IF status = 0 THEN WaitForConnection 'this loops keeps looping until status = 1
DEBUG "Status Pin HIGH. Connection established", CR
Now lets say I don't want to wait for a connection forever (like that code is doing, just keeps looping until connection). I want to add a timeout, after 15-20 seconds of waiting for a connection, if no connection comes (status still = 0), it goes and does another piece of code. Is there a way to implement a timer of some sorts in the BS2p?
Thanks for your help, very much appreciated.
I have a question about a similar topic that i saw on these boards a few weeks ago, but sadly i cannot find that thread anymore. So sorry if i seem a bit repetitive with this question.
I'm trying to run a bit of code every 15-20 seconds. The precise measuring of time is not important.
I have a Parallax Bluetooth EB500 transceiver attached to my BS2p, and in the code, i have simple lines that say:
'status is an INPUT pin. When status = 1, that means some other Bluetooth device is connected to my EB500
WaitForConnection:
IF status = 0 THEN WaitForConnection 'this loops keeps looping until status = 1
DEBUG "Status Pin HIGH. Connection established", CR
Now lets say I don't want to wait for a connection forever (like that code is doing, just keeps looping until connection). I want to add a timeout, after 15-20 seconds of waiting for a connection, if no connection comes (status still = 0), it goes and does another piece of code. Is there a way to implement a timer of some sorts in the BS2p?
Thanks for your help, very much appreciated.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I learn when I succeed, but I learn more when I fail."
http://forums.parallax.com/showthread.php?p=570148
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com