PDA

View Full Version : SLEEP command



DosEdge
02-03-2007, 04:39 AM
Is anyoneˇfamiliar with the SLEEP command. If you are familiar with it, could you explain to me the sleep duration part. I understand the BS2 has a resolution of 2.034 per second. I do not understand the command in the manual "SLEEP 10" is approximately 11.52 seconds (5 X 2.034). Are you suppose to take highest factor x 2.034 that come close to ten seconds. For the Sleep command to work for 15 minutes, you will have to take in consideration of 900 seconds is (450 X 2.034) 915.3 seconds. Will SLEEP 900 approximate to 15 minutes.

allanlane5
02-03-2007, 04:55 AM
From the help file:
"The unit of time for Duration is one second, though the BASIC Stamp rounds up to the nearest multiple of 2.3 seconds."

So, the BS2 can give you 2.3 seconds if you specify 1 or 2. 4.6 seconds if you specify 3 or 4. 6.9 seconds if you specify 5 or 6. 9.2 seconds if you specify 7, 8, or 9. And 11.5 seconds if you specify 10 or 11.

So, let's see. 10 seconds, divided by 2.304, will be 4.34 'internal sleep ticks'.

So you'll really get 5 'internal sleep ticks', or 11.52 seconds.

900 seconds, divided by 2.304, will be 390.625 'internal sleep ticks'. So you'll actually get 391 'internal sleep ticks', which will actually be 900.864 seconds. Or 15.0144 minutes. Or 15 minutes, 0.864 seconds.

Bottom line -- Sleep 900 will give you 15 minutes, 0.864 seconds, which is 15 minutes.ˇ Yes.
ˇ

DosEdge
02-03-2007, 05:00 AM
Thanks allanlane5, have a nice weekend!

I will reserve all my questions for you first thing Monday morning.

Thank you

DosEdge