📄 serialout_nag.m
字号:
%Matlab Code
%If program doesn't close and delete the serial port object correctly,
%use the command shown below to delete all of the serial port objects.
%delete(instrfind)
s = serial('COM1','BAUD',9600); % Create serial object (PORT Dependent)
fopen(s) % Open the serial port for r/w
%fprintf(s, '*');
%myChar = 'a';
%prompt = 'Enter a character (q to exit): ';
%out = fscanf(s);
%while (myChar ~= 'q') % While user hasn't typed 'q'
fprintf(s, 'A') % Write first char of user input to serial port
fprintf(fscanf(s)) % Read Data back from PIC
%myChar = input(prompt, 's'); % Get user input
%end
fclose(s); % Close the serial port
delete(s); % Delete the serial objectwhile(!q)
clear s;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -