Skip to content
Snippets Groups Projects
Commit 1daf6771 authored by Tim Stadtmann's avatar Tim Stadtmann
Browse files

Add and fix examples

parent 34f80fa5
Branches
Tags
No related merge requests found
b = EV3('debug', 0);
b.connect('usb');
s = b.sensor4;
if s.type ~= DeviceType.UltraSonic
error('Connect US-sensor to port 4');
end
s.mode = DeviceMode.UltraSonic.DistCM;
readings = [];
time = [];
tic
hold on;
while toc < 20
readings = [readings, s.value];
time = [time, toc];
% plot(time, readings)
% drawnow
end
hold off;
fprintf('\nSensor readings per sec: %f\n', length(readings)/time(length(time)));
b.disconnect();
%% Results
% Bluetooth
% debug=2, sensor-typ-kontrolle an: 7.5 Readings/sec % worst case
% debug=1, sensor-typ-kontrolle an: 9.3 readings/sec
% debug=0, sensor-typ-kontrolle an: 9.6 readings/sec
% debug=0, sensor-typ-kontrolle aus: 16.5 readings/sec
% debug=0, sensor-typ-kontrolle aus, plotting aus: 22.5 readings/sec % best case
% debug=0, sensor-typ-kontrolle an, plotting aus: 10
% USB
% debug=2, sensor-typ-kontrolle an: 16.5 readings/sec % worst case
% debug=0, sensor-typ-kontrolle aus, plotting aus: 100 readings/sec % best case
%
% -> NOTIZ AN MICH: TYP KONTROLLE ÜBERDENKEN
......@@ -19,7 +19,7 @@ function testConnSpeed(ioType, serPort, it, withResponse)
end
m = b.motorB;
m.setProperties('power', 10, 'tachoLimitMode', 'Time', 'tachoLimit', 15000);
m.setProperties('power', 10, 'limitMode', 'Time', 'limitValue', 15000);
m.resetTachoCount();
if withResponse
......
......@@ -5,8 +5,8 @@ b.sensor4.mode = DeviceMode.UltraSonic.DistCM;
tic;
t = 0;
b.motorA.setProperties('power', 50, 'speedRegulation', 'on', 'smoothStart', 10, 'tachoLimitMode', ...
'Time', 'tachoLimit', 3000);
b.motorA.setProperties('power', 50, 'speedRegulation', 'on', 'smoothStart', 10, 'limitMode', ...
'Time', 'limitValue', 3000);
b.motorA.start();
pause(0.5);
......@@ -17,12 +17,13 @@ while b.motorA.isRunning()
end
b.motorB.power = 50;
b.motorB.tachoLimit = 4*360;
b.motorB.limitValue = 4*360;
b.motorB.start();
b.motorB.waitFor();
b.beep();
b.motorA.speedRegulation = false;
pause(1);
b.motorA.syncedStart(b.motorB, 'turnRatio', 200);
b.motorA.waitFor();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment