[PD] Comport problem with Arduino: 13 is coming in as 10

Ingo ingo at miamiwave.com
Tue May 14 12:30:58 CEST 2019


The strange thing is that I'm using 2 Arduino ProMicro.

Sometimes one does it and the other one is fine. Next time both of them do it 
and next time none of them.
It's completely unpredictable. The same Arduino sends the same data that gets 
interpreted differently when I reopen Pd.
So I wouldn't blame the Arduino in this case. I don't expect it to send 
different values upon reopening Pd.
(I'm not sure if I did a hardware restart in between - I'll have to observe 
this.)

However, the Pd programming hasn't changed either ...
I know there is some sort of modem code that replaced 13 with 10.
Carriage Return is 13. Line Feed is 0x10.
In some cases The Carriage Return is either followed or even replaced by Line 
Feed.
It looks like this is happening here.

The question is: How can I control this type of Carriage Return behavior?
I don not my Arduino to be handled as an old modem ...


> I have tried Serial.write(13) and Serial.print((char)13) and they both 
> output 10 in Pd. The work-around I have figured to this is to write a second 
> byte after every
> value I send, and in case of sending a 13, send a unique value to this 
> second byte, so that Pd knows it should be receiving a 13. It's double the 
> load but in most
> cases it shouldn't be a problem, especially when writing raw bytes with 
> Serial.write().

I have already a bunch of units out with the same hardware.
So changing the programming on the Arduino is not necessarily the best choice.

Ingo


> -----Original Message-----
> From: Pd-list [mailto:pd-list-bounces at lists.iem.at] On Behalf Of Roman
> Haefeli
> Sent: Tuesday, May 14, 2019 11:38 AM
> To: pd-list at lists.iem.at
> Subject: Re: [PD] Comport problem with Arduino: 13 is coming in as 10
>
> On Tue, 2019-05-14 at 10:00 +0100, Alexandros wrote:
> > On 14/5/19 9:45 p. ., Roman Haefeli wrote:
> > > Hi Ingo
> > >
> > > On Tue, 2019-05-14 at 07:38 +0200, Ingo wrote:
> > > > I'm getting number 10 instead of 13 from my adruino.
> > >
> > > This sounds somehow familiar to me, but I can't recall the exact
> > > details of the issue nor am I able to find something about it on the
> > > web.
> > >
> > > Have you ruled out any other source besides [comport]?  Can you
> > > print the data with some other tool to make sure that the Arduino is
> > > not messing up the bytes 10 and 13? If it indeed [comport] is the
> > > culprit, then it should be quite easy to fix, but then again there
> > > we probably would find code that does the translation. I am not sure
> > > such code exists.
> >
> > I have been having the same issue for quite some time now, and have
> > posted it in this list in the past.
>
> Have you ruled out any other culprit? Have checked what is sent with some
> means other than [comport], for instance with the Arduino IDE? I don't have
> an Arduino at hand, so I don't know the exact procedure, but maybe there is
> a way to print data as hex values or so.
>
> Roman







More information about the Pd-list mailing list