While... wend loop

David McFarlane mcfarla9 at msu.edu
Tue Dec 11 18:13:42 UTC 2007


Nikos,

>does anybody know an eprime function equivalent to the MATLAB tic 
>toc functions?
>
>I need to create a loop that lasts for 1 second while the 
>Serial.WriteString method is called and don't know how!
>
>Below is a code that worked for me but I think there's a better way:
>
>While i <161
>  Serial.WriteString EnableRC
>  i = i +1
>Wend

You  probably want to use the Sleep() statement.  If you only need to 
call Serial.WriteString once and then wait for 1 second, do this,

Serial.WriteString EnableRC
Sleep(1000)

If however you really mean to repeatedly write the Serial.WriteString 
for a period of one second then you'd be better off using the 
Clock.Read method, like this,

Dim tStop as Long
tStop = Clock.Read + 1000
Do
     Serial.WriteString EnableRC
Loop Until (Clock.Read >= tStop)

Regards,
-- David

---
David McFarlane, Systems Designer
Dept. Psychology, Michigan State University
mcfarla9 at msu.edu    www.msu.edu/~mcfarla9
Voice: (517) 353-0799    Fax: (517) 353-1652


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com
To unsubscribe from this group, send email to e-prime-unsubscribe at googlegroups.com
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en
-~----------~----~----~----~------~----~------~--~---



More information about the Eprime mailing list