serialout_nag.m
来自「a code which export a letter/array to se」· M 代码 · 共 20 行
M
20 行
%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 + =
减小字号Ctrl + -
显示快捷键?