diff --git a/source/EV3.m b/source/EV3.m index d6e62bc1b550376d624c0e329b5dd29f3d3a86d9..1476eb45ca401b6ec45a8fb1f4601f71eda5ad58 100644 --- a/source/EV3.m +++ b/source/EV3.m @@ -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 + % 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; % - % 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| properties % batteryMode (string in {'Percentage', 'Voltage'}): Mode for reading battery charge. [WRITABLE] @@ -158,13 +159,16 @@ 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 usb connection, beep when connection has been established - % b = EV3(); % |br| - % b.connect('usb', 'beep', 'on', ); % |br| + % + % :: + % + % Example: + % % Setup bluetooth connection via com-port 0 + % b = EV3(); + % b.connect('bt', 'serPort', '/dev/rfcomm0'); + % % Setup usb connection, beep when connection has been established + % b = EV3(); + % b.connect('usb', 'beep', 'on', ); % % See also ISCONNECTED / :attr:`isConnected` @@ -226,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| + % + % :: + % + % Example: + % b = EV3(); + % b.connect('bt', 'serPort', '/dev/rfcomm0'); + % % do stuff + % b.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 @@ -272,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| + % + % :: + % + % Example: + % b = EV3(); + % b.connect('bt', 'serPort', '/dev/rfcomm0'); + % b.beep(); % ev3.handleCommand(@soundPlayTone, 10, 1000, 100); end @@ -288,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| + % + % :: + % + % Example: + % b = EV3(); + % b.connect('bt', 'serPort', '/dev/rfcomm0'); + % b.playTone(40, 5000, 1000); % Plays tone with 40% volume and 5000Hz for 1 second. % ev3.handleCommand(@soundPlayTone, volume, frequency, duration); end @@ -300,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| + % + % :: + % + % Example: + % b = EV3(); + % b.connect('bt', 'serPort', '/dev/rfcomm0'); + % b.playTone(10,100,100000000); + % b.stopTone(); % Stops tone immediately. % ev3.handleCommand(@soundStopTone); end @@ -315,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: + % b = EV3(); + % b.connect('bt', 'serPort', '/dev/rfcomm0'); + % b.playTone(10, 100, 1000); + % pause(0.5); + % % Small pause necessary since tone not startong immediately + % b.tonePlayed(); % -> Outputs 1 to console. % status = ev3.handleCommand(@soundTest); end @@ -372,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| + % + % :: + % + % Example: + % b = EV3(); + % b.connect('bt', 'serPort', '/dev/rfcomm0'); + % b.setProperties('debug', 'on', 'batteryMode', 'Voltage'); + % % Instead of: b.debug = 'on'; b.batteryMode = 'Voltage'; % % See also EV3.DEBUG, EV3.BATTERYMODE / :attr:`debug`, :attr:`batteryMode`