I found this example which sorta works... but it's not perfect. For starters it plots 10 at once but that's an easy fix. Problem is that it does not dynamically get line endings and instead relies on byte count.
pkg load instrument-control
s1 = serialport("/dev/ttyUSB0", 9600)
flush(s1);
y_temp = cell(10,1)
y = 0
while true
for i = 1:10
y_serial = str2num(char(fread(s1,8)))
y_temp {i,1} = y_serial
endfor
y = cat(1, y, y_temp{1:10})
plot(y)
pause(1)
endwhile
srl_close(s1)
This works... so long as the number of bytes per string is 8. How can I make this dynamic and split by line endings?
All I need to do is plot incrementing by 1 x_value and a float y_value from serial.
https://www.edn.com/read-serial-data-directly-into-octave/
Solution found. Their is no inbuilt solution but you can make your own function like:
This does not actually work straight off and I had to add \n to my Arduino script.