2.74 MATLAB code for Interface to Nucleo
Revision 9:3d6b58589448, committed 2020-09-12
- Comitter:
- elijahsj
- Date:
- Sat Sep 12 16:16:24 2020 +0000
- Parent:
- 8:58d93d7564ed
- Commit message:
- finalized lab 2;
Changed in this revision
Experiment_Example_MATLAB.m | Show annotated file Show diff for this revision Revisions of this file |
--- a/Experiment_Example_MATLAB.m Thu Aug 27 16:00:16 2020 +0000 +++ b/Experiment_Example_MATLAB.m Sat Sep 12 16:16:24 2020 +0000 @@ -3,17 +3,17 @@ subplot(311) h1 = plot([0],[0]); h1.XData = []; h1.YData = []; - ylabel('Position (counts)'); + ylabel('Position'); subplot(312) h2 = plot([0],[0]); h2.XData = []; h2.YData = []; - ylabel('Velocity (counts/s)'); + ylabel('Velocity'); subplot(313) h3 = plot([0],[0]); h3.XData = []; h3.YData = []; - ylabel('Current (16 bit ADC counts)'); + ylabel('Current (Amps)'); % This function will get called any time there is new data from % the FRDM board. Data comes in blocks, rather than one at a time. @@ -32,15 +32,15 @@ h3.YData(end+1:end+N) = curr; end - frdm_ip = '192.168.1.100'; % FRDM board ip - frdm_port= 11223; % FRDM board port + frdm_ip = '192.168.1.100'; % Nucleo board ip + frdm_port= 11223; % Nucleo board port params.callback = @my_callback; % callback function params.timeout = 2; % end of experiment timeout % The example program provided takes two arguments - v1 = 0.5; % pwm applied for first second - v2 = 0; % pwm applied for second second - input = [v1 v2]; % input sent to FRDM board + d1 = 0.5; % pwm duty cycle applied for first second + d2 = 0; % pwm duty cycle applied for second second + input = [d1 d2]; % input sent to Nucleo board output_size = 4; % number of outputs expected output_data = RunExperiment(frdm_ip,frdm_port,input,output_size,params);