Re: Read/write serial data

Jon Christopher <[email protected]> Fri, 23 Oct 2020 15:53:59 -0700
Newsgroups gmane.comp.lang.jython.user
Message-ID <CAMK40dosAO3qUPfmmm1MYQ++P9M5170vx6Vk_JfVDBVFc7=sbg@mail.gmail.com>
--===============9217953421711900842==
Content-Type: multipart/alternative; boundary="0000000000006fa50b05b25e7506"

--0000000000006fa50b05b25e7506
Content-Type: text/plain; charset="UTF-8"

Not jython-specific, but have you tried pyserial by any chance?

It looks pretty simple:

https://pyserial.readthedocs.io/en/latest/shortintro.html

>>> ser = serial.Serial('COM3', 38400, timeout=0,...                     parity=serial.PARITY_EVEN, rtscts=1)>>> s = ser.read(100)       # read up to one hundred bytes...                         # or as much is in the buffer





On Fri, Oct 23, 2020 at 2:34 PM James Kelly <[email protected]> wrote:

> Hi,
> I'm aware of the fact that I'm about to ask a lot of the group but I do
> need the help. I dabble with programming but have to acknowledge that what
> I need is beyond my abilities to develop; so I hope the group will take
> mercy on an old retired model railroader.
> I have an Arduino that I need to pass ASCII to/from a computer through a
> USB COM1 port.  I want to use Jython as I am running Win-10 with a JRE.
> I find a lot of code samples, most using the RXTX library, but nothing
> demonstrating a way the user can input data to send and and at least a
> print statement to show the ASCII input. Most code seems to be in Java and
> I know from reading that it can be used from within Jython.
> I'm old school (before OOP) and to be honest I find the code snippets to
> be confusing. Is there a working example on-line or in a reference book
> that demonstrates what I need -- start to finish?
> Jim K.
> Houston TX.
> _______________________________________________
> Jython-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jython-users
>

--0000000000006fa50b05b25e7506
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Not jython-specific, but have you tried pyserial by any ch=
ance?<div><br></div><div>It looks pretty simple:</div><div><br></div><div><=
a href=3D"https://pyserial.readthedocs.io/en/latest/shortintro.html">https:=
//pyserial.readthedocs.io/en/latest/shortintro.html</a><br></div><div><br><=
/div><div><pre style=3D"box-sizing:border-box;font-family:SFMono-Regular,Me=
nlo,Monaco,Consolas,&quot;Liberation Mono&quot;,&quot;Courier New&quot;,Cou=
rier,monospace;font-size:12px;margin-top:0px;margin-bottom:0px;padding:12px=
;overflow:auto;line-height:normal;color:rgb(64,64,64)"><span class=3D"gmail=
-gp" style=3D"box-sizing:border-box;color:rgb(198,93,9);font-weight:bold">&=
gt;&gt;&gt; </span><span class=3D"gmail-n" style=3D"box-sizing:border-box">=
ser</span> <span class=3D"gmail-o" style=3D"box-sizing:border-box;color:rgb=
(102,102,102)">=3D</span> <span class=3D"gmail-n" style=3D"box-sizing:borde=
r-box">serial</span><span class=3D"gmail-o" style=3D"box-sizing:border-box;=
color:rgb(102,102,102)">.</span><span class=3D"gmail-n" style=3D"box-sizing=
:border-box">Serial</span><span class=3D"gmail-p" style=3D"box-sizing:borde=
r-box">(</span><span class=3D"gmail-s1" style=3D"box-sizing:border-box;colo=
r:rgb(64,112,160)">&#39;COM3&#39;</span><span class=3D"gmail-p" style=3D"bo=
x-sizing:border-box">,</span> <span class=3D"gmail-mi" style=3D"box-sizing:=
border-box;color:rgb(32,128,80)">38400</span><span class=3D"gmail-p" style=
=3D"box-sizing:border-box">,</span> <span class=3D"gmail-n" style=3D"box-si=
zing:border-box">timeout</span><span class=3D"gmail-o" style=3D"box-sizing:=
border-box;color:rgb(102,102,102)">=3D</span><span class=3D"gmail-mi" style=
=3D"box-sizing:border-box;color:rgb(32,128,80)">0</span><span class=3D"gmai=
l-p" style=3D"box-sizing:border-box">,</span>
<span class=3D"gmail-gp" style=3D"box-sizing:border-box;color:rgb(198,93,9)=
;font-weight:bold">... </span>                    <span class=3D"gmail-n" s=
tyle=3D"box-sizing:border-box">parity</span><span class=3D"gmail-o" style=
=3D"box-sizing:border-box;color:rgb(102,102,102)">=3D</span><span class=3D"=
gmail-n" style=3D"box-sizing:border-box">serial</span><span class=3D"gmail-=
o" style=3D"box-sizing:border-box;color:rgb(102,102,102)">.</span><span cla=
ss=3D"gmail-n" style=3D"box-sizing:border-box">PARITY_EVEN</span><span clas=
s=3D"gmail-p" style=3D"box-sizing:border-box">,</span> <span class=3D"gmail=
-n" style=3D"box-sizing:border-box">rtscts</span><span class=3D"gmail-o" st=
yle=3D"box-sizing:border-box;color:rgb(102,102,102)">=3D</span><span class=
=3D"gmail-mi" style=3D"box-sizing:border-box;color:rgb(32,128,80)">1</span>=
<span class=3D"gmail-p" style=3D"box-sizing:border-box">)</span>
<span class=3D"gmail-gp" style=3D"box-sizing:border-box;color:rgb(198,93,9)=
;font-weight:bold">&gt;&gt;&gt; </span><span class=3D"gmail-n" style=3D"box=
-sizing:border-box">s</span> <span class=3D"gmail-o" style=3D"box-sizing:bo=
rder-box;color:rgb(102,102,102)">=3D</span> <span class=3D"gmail-n" style=
=3D"box-sizing:border-box">ser</span><span class=3D"gmail-o" style=3D"box-s=
izing:border-box;color:rgb(102,102,102)">.</span><span class=3D"gmail-n" st=
yle=3D"box-sizing:border-box">read</span><span class=3D"gmail-p" style=3D"b=
ox-sizing:border-box">(</span><span class=3D"gmail-mi" style=3D"box-sizing:=
border-box;color:rgb(32,128,80)">100</span><span class=3D"gmail-p" style=3D=
"box-sizing:border-box">)</span>       <span class=3D"gmail-c1" style=3D"bo=
x-sizing:border-box;color:rgb(64,128,144);font-style:italic"># read up to o=
ne hundred bytes</span>
<span class=3D"gmail-gp" style=3D"box-sizing:border-box;color:rgb(198,93,9)=
;font-weight:bold">... </span>                        <span class=3D"gmail-=
c1" style=3D"box-sizing:border-box;color:rgb(64,128,144);font-style:italic"=
># or as much is in the buffer</span></pre><pre style=3D"box-sizing:border-=
box;font-family:SFMono-Regular,Menlo,Monaco,Consolas,&quot;Liberation Mono&=
quot;,&quot;Courier New&quot;,Courier,monospace;font-size:12px;margin-top:0=
px;margin-bottom:0px;padding:12px;overflow:auto;line-height:normal;color:rg=
b(64,64,64)"><span class=3D"gmail-c1" style=3D"box-sizing:border-box;color:=
rgb(64,128,144);font-style:italic"><br></span></pre><pre style=3D"box-sizin=
g:border-box;font-family:SFMono-Regular,Menlo,Monaco,Consolas,&quot;Liberat=
ion Mono&quot;,&quot;Courier New&quot;,Courier,monospace;font-size:12px;mar=
gin-top:0px;margin-bottom:0px;padding:12px;overflow:auto;line-height:normal=
;color:rgb(64,64,64)"><br></pre></div><div><br></div></div><br><div class=
=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Oct 23, 2020=
 at 2:34 PM James Kelly &lt;<a href=3D"mailto:[email protected]">jwkelly4=
[email protected]</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-size=
:large">Hi,<br>I&#39;m aware of the fact that I&#39;m about to ask a lot of=
 the group but I do need the help. I dabble with programming but have to ac=
knowledge that what I need is beyond my abilities to develop; so I hope the=
 group will take mercy on an old retired model railroader.<br>I have an Ard=
uino that I need to pass ASCII to/from a computer through a USB COM1 port.=
=C2=A0 I want to use Jython as I am running Win-10 with a JRE.<br>I find a =
lot of code samples, most using the RXTX library, but nothing demonstrating=
 a way the user can input data to send and and at least a print statement t=
o show the ASCII input. Most code seems to be in Java and I know from readi=
ng that it can be used from within Jython.<br>I&#39;m old school (before OO=
P) and to be honest I find the code snippets to be confusing. Is there a wo=
rking example on-line or in a reference book that demonstrates what I need =
-- start to finish?<br>Jim K.<br>Houston TX.<br></div></div>
_______________________________________________<br>
Jython-users mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">Jyt=
[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/jython-users" rel=
=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listi=
nfo/jython-users</a><br>
</blockquote></div>

--0000000000006fa50b05b25e7506--


--===============9217953421711900842==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============9217953421711900842==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Jython-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-users

--===============9217953421711900842==--