pyserial newbie questions
uptonothing at yahoo.com
Thu Apr 10 16:46:28 CEST 2003
"Gilles" <gilles.celli at ecgs.lu> wrote in message
news:gilles.celli-943DC4.10083810042003 at webmail.restena.lu...
> Hello folks,
> Since I am very new to Python I have the following question:
> I try to write a program in Python (on RHat 8.0 Linux) with the
> "pyserial" module which communicates to a device via RS232 serial cable.
> The program should do:
> 1. Set Com port to 300,n,8,1
> 2. Send 20 NULL characters Chr(0)
> 3. Wait 10 ms ( may vary in your case)
> 4. Send a string "HELLO"
> 5. Wait to receive ³READY² string from device
> 6. If above string OK SEND ³START²
> I figured out how to set the port, send the 20 NULL characters :)
> But I have no idea how to "wait for 10ms", send the HELLO string and
> read the READY string...
> Anyone has a clue or source code sample ?
> Thanks a lot.
I don't know if this is the answer you're looking for but you can use the
sleep(secs) function in the time module.
time.sleep(.01) # sleep 10 ms
More information about the Python-list