Skip to content
Snippets Groups Projects
Commit c55f886d authored by Maximilian Schnabel's avatar Maximilian Schnabel
Browse files

Revert "disabled warning when using connect() with an established connection, because..."

This reverts commit 1358c13c
parent d398f5e1
Branches
No related tags found
2 merge requests!7Keep going if mountpoint exists (persistent),!6Docs NXT compatibility
......@@ -35,19 +35,20 @@ classdef EV3 < MaskedHandle
% batteryValue (numeric): Current battery charge. Depending on batteryMode, the reading is either in percentage or voltage. See also :attr:`batteryMode`. *[READ-ONLY]*
% isConnected (bool): True if virtual brick-object is connected to physical one. *[READ-ONLY]*
%
% ::
%
% Example:
% % This example expects a motor at port A and a (random) sensor at port 1 |br|
% b = EV3(); % |br|
% b.connect('usb'); % |br|
% ma = b.motorA; % |br|
% ma.setProperties('power', 50, 'limitValue', 720); % |br|
% ma.start(); % |br|
% % fun |br|
% ma.waitFor(); % |br|
% disp(b.sensor1.value); % |br|
% b.beep(); % |br|
% delete b; % |br|
% # This example expects a motor at port A and a (random) sensor at port 1
% brick = EV3();
% brick.connect('usb');
% motorA = brick.motorA;
% motorA.setProperties('power', 50, 'limitValue', 720);
% motorA.start();
% motorA.waitFor();
% disp(brick.sensor1.value);
% brick.beep();
% delete brick;
%
properties
% batteryMode (string in {'Percentage', 'Voltage'}): Mode for reading battery charge. [WRITABLE]
......@@ -158,21 +159,22 @@ classdef EV3 < MaskedHandle
% (necessary if connectionType is 'bt'). *[OPTIONAL]*
% beep (bool): If true, EV3 beeps if connection has been established. *[OPTIONAL]*
%
%
% ::
%
% Example:
% % Setup bluetooth connection via com-port 0 |br|
% b = EV3(); % |br|
% b.connect('bt', 'serPort', '/dev/rfcomm0'); % |br|
% % Setup bluetooth connection via com-port 0
% brick = EV3();
% brick.connect('bt', 'serPort', '/dev/rfcomm0');
% % Setup usb connection, beep when connection has been established
% b = EV3(); % |br|
% b.connect('usb', 'beep', 'on', ); % |br|
% brick = EV3();
% brick.connect('usb', 'beep', 'on', );
%
% See also ISCONNECTED / :attr:`isConnected`
if ev3.isConnected
if isCommInterfaceValid(ev3.commInterface)
% Warning lead to confusion of students. Since brick connection is still working
% even if calling connect() multiple times, it is disabled.
% warning('EV3::connect: Already connected. Resetting connection now...');
warning('EV3::connect: Already connected. Resetting connection now...');
ev3.disconnect();
else
warning(['EV3::connect: EV3.isConnected is set to ''True'', but ',...
......@@ -228,11 +230,14 @@ classdef EV3 < MaskedHandle
% Notes:
% * Gets called automatically when EV3-object is destroyed.
%
%
% ::
%
% Example:
% b = EV3(); % |br|
% b.connect('bt', 'serPort', '/dev/rfcomm0'); % |br|
% % do stuff |br|
% b.disconnect(); % |br|
% brick = EV3();
% brick.connect('bt', 'serPort', '/dev/rfcomm0');
% % do stuff
% brick.disconnect();
% Resetting needs a working connection in order to send reset-commands
% to the Brick. If the connection has been aborted (e.g. by pulling the
......@@ -274,10 +279,13 @@ classdef EV3 < MaskedHandle
% Notes:
% * This equals playTone(10, 1000, 100).
%
%
% ::
%
% Example:
% b = EV3(); % |br|
% b.connect('bt', 'serPort', '/dev/rfcomm0'); % |br|
% b.beep(); % |br|
% brick = EV3();
% brick.connect('bt', 'serPort', '/dev/rfcomm0');
% brick.beep();
%
ev3.handleCommand(@soundPlayTone, 10, 1000, 100);
end
......@@ -290,11 +298,13 @@ classdef EV3 < MaskedHandle
% frequency (numeric in [250, 10000]): in Hertz
% duration (numeric > 0): in milliseconds
%
%
% ::
%
% Example:
% b = EV3(); % |br|
% b.connect('bt', 'serPort', '/dev/rfcomm0'); % |br|
% b.playTone(40, 5000, 1000); % Plays tone with 40% volume and 5000Hz for 1
% second. |br|
% brick = EV3();
% brick.connect('bt', 'serPort', '/dev/rfcomm0');
% brick.playTone(40, 5000, 1000); % Plays tone with 40% volume and 5000Hz for 1 second.
%
ev3.handleCommand(@soundPlayTone, volume, frequency, duration);
end
......@@ -302,11 +312,14 @@ classdef EV3 < MaskedHandle
function stopTone(ev3)
% Stops tone currently played.
%
%
% ::
%
% Example:
% b = EV3(); % |br|
% b.connect('bt', 'serPort', '/dev/rfcomm0'); % |br|
% b.playTone(10,100,100000000); % Accidentally given wrong tone duration :) |br|
% b.stopTone(); % Stops tone immediately. |br|
% brick = EV3();
% brick.connect('bt', 'serPort', '/dev/rfcomm0');
% brick.playTone(10,100,100000000);
% brick.stopTone(); % Stops tone immediately.
%
ev3.handleCommand(@soundStopTone);
end
......@@ -317,12 +330,16 @@ classdef EV3 < MaskedHandle
% Returns:
% status (bool): True if a tone is being played
%
% Example
% b = EV3(); % |br|
% b.connect('bt', 'serPort', '/dev/rfcomm0'); % |br|
% b.playTone(10, 100, 1000); % |br|
% pause(0.5); % Small pause is necessary as tone does not start instantaneously |br|
% b.tonePlayed(); % -> Outputs 1 to console. |br|
%
% ::
%
% Example:
% brick = EV3();
% brick.connect('bt', 'serPort', '/dev/rfcomm0');
% brick.playTone(10, 100, 1000);
% pause(0.5);
% % Small pause necessary since tone not startong immediately
% brick.tonePlayed(); % -> Outputs 1 to console.
%
status = ev3.handleCommand(@soundTest);
end
......@@ -374,11 +391,14 @@ classdef EV3 < MaskedHandle
% debug (numeric in {0,1,2}): see EV3.debug *[OPTIONAL]*
% batteryMode (string in {'Voltage'/'Percentage'}): see EV3.batteryMode *[OPTIONAL]*
%
%
% ::
%
% Example:
% b = EV3(); % |br|
% b.connect('bt', 'serPort', '/dev/rfcomm0'); % |br|
% b.setProperties('debug', 'on', 'batteryMode', 'Voltage'); % |br|
% % Instead of: b.debug = 'on'; b.batteryMode = 'Voltage'; % |br|
% brick = EV3();
% brick.connect('bt', 'serPort', '/dev/rfcomm0');
% brick.setProperties('debug', 'on', 'batteryMode', 'Voltage');
% % Instead of: b.debug = 'on'; b.batteryMode = 'Voltage';
%
% See also EV3.DEBUG, EV3.BATTERYMODE / :attr:`debug`, :attr:`batteryMode`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment