Example right there in my last post...
Your one second pause =
Pause 1000
Another way to do it, and to check stuff in between...
For temp = 1 to 1000
Pause 1
'check for other stuff
Next temp
Of course the looped way of doing it will always end up being over one second, so you might end up having to use 900 instead of 1000 depending on how much 'check for other stuff' you do.
Past that, you could always learn about interrupts and use those as you initially suggested.
But, I'd suggest you get rid of that POT command and whatever light sensing resistors you're using and switch over to some sort of 'beam breaking' method or maybe a magnetic reed switch since slot cars tend to have magnets in them (don't they?). The POT command takes too much time with what you want to do, and it's a show stopping command. When the POT command is executing, nothing else is, hence you miss a second car while trying to sense the first.
With the beam breaking method, you can instantly scan multiple lanes and put each beam break into a queue with a time stamp and send the information out the serial port when you want.
Bookmarks