Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #19968

Re: how to read serial stream of data [newbie]

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'debug': 0.03; 'specifying': 0.07; 'filename': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'enabling': 0.13; '...,': 0.16; 'bieber': 0.16; 'creation.': 0.16; 'email addr:ix.netcom.com': 0.16; 'email name:wlfraed': 0.16; 'from:addr:ix.netcom.com': 0.16; 'from:addr:wlfraed': 0.16; 'from:name:dennis lee bieber': 0.16; 'message-id:@4ax.com': 0.16; 'received:wlfraed': 0.16; 'timeout.': 0.16; 'url:netcom': 0.16; 'url:wlfraed': 0.16; 'wulfraed': 0.16; 'wrote:': 0.18; 'perl': 0.18; 'received:166': 0.18; 'previously': 0.19; 'url:home': 0.21; 'feb': 0.22; 'string': 0.24; 'preferred': 0.25; 'subject:data': 0.25; 'skip:= 10': 0.28; 'second': 0.28; 'example': 0.29; 'print': 0.29; 'jean': 0.30; 'tue,': 0.32; 'header:X-Complaints-To:1': 0.34; 'lee': 0.34; 'setting': 0.34; 'to:addr:python-list': 0.35; '...': 0.35; 'subject:]': 0.36; 'received:org': 0.36; 'but': 0.37; 'charset:us-ascii': 0.37; 'could': 0.38; 'should': 0.38; 'subject:how': 0.39; 'to:addr:python.org': 0.40; 'here': 0.64; 'opened': 0.64; 'high': 0.66; 'note:': 0.69; 'serial': 0.71; 'dennis': 0.73; '(your': 0.84; '-0800': 0.84; 'subject:read': 0.84; 'subject:stream': 0.84; 'usage;': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: how to read serial stream of data [newbie]
Date Tue, 07 Feb 2012 12:44:36 -0500
References <e84f3af4-da6d-4ae9-8974-54354ec16307@b18g2000vbz.googlegroups.com> <roy-5854D8.00073507022012@news.panix.com> <cd2a40a2-5f6f-461c-9d02-f2e9e8732e6f@l14g2000vbe.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host mobile-166-147-101-215.mycingular.net
X-Newsreader Forte Agent 6.00/32.1186
X-No-Archive YES
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5505.1328636706.27778.python-list@python.org> (permalink)
Lines 38
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328636706 news.xs4all.nl 6980 [2001:888:2000:d::a6]:60124
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19968

Show key headers only | View raw


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 | NextPrevious in thread | Find similar | Unroll thread


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