Data logging microprocessor serial monitor continiously

4 Ansichten (letzte 30 Tage)
Bastiaan Pierik
Bastiaan Pierik am 21 Jan. 2021
Bearbeitet: Bastiaan Pierik am 21 Jan. 2021
I recently participated in a Matlab course and was wondering how to readout a teensy over serial and how to search directly on temperature values ; current values and plot them against the time stamp from themicroprocessor Millis on the screen.
I looked up some code, but I can’t program at the moment due to no access of Matlab on my work/Homeoffice or try it out.
This the pseudo borrowed code, I know that I am in the right direction,
info = instrhwinfo('serial'); if isempty(info.AvailableSerialPorts) error('No ports free!'); end s = serial(info.AvailableSerialPorts{1}, 'BaudRate', 9600); open_data = fopen(s) line = fgetl (open_data) scan_line = sscanf (line, '%f,%f,%f) (depending on the output) % it returns as too many argument open_data = fopen(s)
Timestamp = millis();
Timeraw =char(sizeof(line)); Timemeasured=char(sizeof(line)) TimeTeensy=insertBefore(line,‘ms‘,Timemeasured));
%LineT= "78c 72c 64c 66c 49c"; degreeSymbol = char(sizeof(line); Tempraw = insertBefore(line,‘c‘,degreeSymbol)
%LineA= "3,1A 72A 64A 66A 49A"; Currentsymbol = char(sizeof(line); Ampere= insertBefore(line,‘a’,Current)
Plot(Time,T_TC1, linespec, Time, T_TC2, linespec2, Time,T_TC3, linespec, Time, T_TC4, linespec); Hold on;
Plot(Time,TEC_A1, linespec, Time, TEC_A2, linespec2, Time,TEC_A3, linespec, Time, TEC_A4, linespec);
Plot(Time,, linespec, Time, TEC_A2, linespec2, Time,TEC_A3, linespec, Time, TEC_A4, linespec);
Hold off Legend(); Xlabel(,); YLabel(,);
Many thanks for your time and your quick review

Antworten (0)

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by