/
read_data.m
32 lines (28 loc) · 1.02 KB
/
read_data.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function [distance,pwm,target,deadpan] = read_data(device)
%% Reads data sent back from Ball and Pipe system
% Inputs:
% ~ device: serialport object controlling the real world system
% Outputs:
% ~ distance: the IR reading from the time of flight sensor
% ~ pwm: the PWM from the manual knob of the system (NOT THE SAME AS THE
% PWM YOU MAY SET THROUGH SERIAL COMMUNICATION)
% ~ target: the desired height of the ball set by the manual knob of the
% system
% ~ deadpan: the time delay after an action set by the manual knob of the
% system
%
% Created by: Kyle Naddeo 1/3/2022
% Modified by: YOUR NAME and DATE
%% Ask nicely for data
% use the serialport() command options to write the correct letter to the
% system (Hint: the letters are in the spec sheet)
%% Read data
% use the serialport() command options to read the response
%% Translate
% translate the response to 4 doubles using str2double() and
% extractBetween() (Hint: the response is in the spec sheet)
% distance =
% manual_pwm =
% target =
% deadpan =
end