help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Serial connection (realtime)


From: Kire Pudsje
Subject: Re: Serial connection (realtime)
Date: Tue, 7 Mar 2017 20:20:01 +0100



On Tue, Mar 7, 2017 at 12:44 PM, GuiCintraAlves <address@hidden> wrote:
The conversion worked. But the code, no. After all what is the real purpose
of this code? Write the data ?? I cony analyze more than one example signal
detect 2 different potentiometers on the same serial?

If the code works, then you are OK.

The code was intended for cases where the microcontroller keeps on spitting out data.
Suppose you read in 10 byte chunks and the following data is being output
1 23 456 78910 111213 141516

in chunks of 10 bytes this is
"1 23 456 7"
"8910 11121"
"3 141516"

processing with str2num would result in
1
23
456
7
8910
11121
3
141516

instead of
1
23
456
78910
111213
141516

So some protection of values crossing chunk borders should be there.
If you do not care about dropping values, you can throw away the first and last value of a chunk.

For outputting 2 values, you could eg do: v1[space]v2[crlf].
But there are lots of ways to (de)serialize data, but that is another topic.
Anyway you have the serial port working.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]