Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19968
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Subject | Re: how to read serial stream of data [newbie] |
| Date | 2012-02-07 12:44 -0500 |
| References | <e84f3af4-da6d-4ae9-8974-54354ec16307@b18g2000vbz.googlegroups.com> <roy-5854D8.00073507022012@news.panix.com> <cd2a40a2-5f6f-461c-9d02-f2e9e8732e6f@l14g2000vbe.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5505.1328636706.27778.python-list@python.org> (permalink) |
On Tue, 7 Feb 2012 04:13:39 -0800 (PST), Jean Dupont
<jeandupont115@gmail.com> wrote:
>filename = raw_input()
Note: this may include the terminating new-line character; you
should strip leading/ending white-space characters.
filename = raw_input().strip()
>ser2 = serial.Serial(voltport, 2400, 8, serial.PARITY_NONE, 1,
>rtscts=0, dsrdtr=0, timeout=15)
Note: this specifying NO FLOW CONTROL (your PERL example is
activating DTR, which could be both enabling DSRDTR control, AND setting
the DTR line high). Finally, you are specifying a 15 SECOND timeout.
>ser2.setDTR(level=True)
Note: here you are setting the DTR level high -- but you previously
opened the port without enabling the use of DSRDTR. Use
..., dsrdtr=True, ...
in the serial port creation.
>print "Opening " + ser2.portstr
ser2.name is the preferred usage; and you opened it with the
serial.Serial() call. And for such debug output, no need for a string
concatenation
print "Reading", ser2.name
>s =ser2.read(11) #read up to 11bytes
print len(s), repr(s)
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
how to read serial stream of data [newbie] Jean Dupont <jeandupont115@gmail.com> - 2012-02-06 13:40 -0800
Re: how to read serial stream of data [newbie] Roy Smith <roy@panix.com> - 2012-02-07 00:07 -0500
Re: how to read serial stream of data [newbie] Jean Dupont <jeandupont115@gmail.com> - 2012-02-07 04:13 -0800
Re: how to read serial stream of data [newbie] Antti J Ylikoski <antti.ylikoski@tkk.fi> - 2012-02-07 15:48 +0200
Re: how to read serial stream of data [newbie] Peter Otten <__peter__@web.de> - 2012-02-07 15:02 +0100
Re: how to read serial stream of data [newbie] Antti J Ylikoski <antti.ylikoski@tkk.fi> - 2012-02-07 19:44 +0200
Re: how to read serial stream of data [newbie] Heiko Wundram <modelnine@modelnine.org> - 2012-02-07 15:04 +0100
Re: how to read serial stream of data [newbie] Jean Dupont <jeandupont115@gmail.com> - 2012-02-07 06:46 -0800
Re: how to read serial stream of data [newbie] Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-02-07 12:44 -0500
csiph-web