Data logging microprocessor serial monitor continiously

3 ビュー (過去 30 日間)
Bastiaan Pierik
Bastiaan Pierik 2021 年 1 月 21 日
編集済み: Bastiaan Pierik 2021 年 1 月 21 日
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

回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by