diff --git a/source/Sensor.m b/source/Sensor.m index a7300c21c8fb501124b2407c7fdf09a30ad42f91..8efc71f765f357bc0afbb6f7d49db7fcf8d9f382 100644 --- a/source/Sensor.m +++ b/source/Sensor.m @@ -1,5 +1,6 @@ classdef Sensor < MaskedHandle - % High-level class to work with sensors. + % High-level class to work with sensors. Information given in this doc can be used to adjust settings of + % sensor objects within the EV3 class. % % The Sensor-class facilitates the communication with sensors. This mainly consists of % reading the sensor's type and current value in a specified mode. @@ -14,62 +15,124 @@ classdef Sensor < MaskedHandle % follows: *brickObject.motorA.setProperties('power', 50);* % % Attributes: - % mode (DeviceMode.{Type}): Sensor mode in which the value will be read. By default, mode is set to *DeviceMode.Default.Undefined*. See also :attr:`type`. *[WRITABLE]* |br| Once a physical sensor is connected to the port *and* the physical Brick is connected to the EV3-object, the allowed mode and the default mode for a Sensor-object are the following (depending on the sensor type): + % mode (DeviceMode.{Type}): Sensor mode in which the value will be read. By default, mode is set to *DeviceMode.Default.Undefined*. See also :attr:`type`. *[WRITABLE]* |br| Once a physical sensor is connected to the port *and* the physical Brick is connected to the EV3-object, the allowed mode and the default mode for a Sensor-object are the following (depending on the sensor type): % % * Touch-Sensor: % * DeviceMode.Touch.Pushed *[Default]* + % *Output: 0: not pushed, 1: pushed % * DeviceMode.Touch.Bumps + % *Output: n: number of times being pushed % * Ultrasonic-Sensor: % * DeviceMode.UltraSonic.DistCM *[Default]* + % *Output: distance in cm + % *Note: actively creates ultrasonic sound % * DeviceMode.UltraSonic.DistIn + % *Output: distance in inches + % *Note: actively creates ultrasonic sound % * DeviceMode.UltraSonic.Listen + % *Output: distance in cm + % *Note: ONLY listens to other sources (sensors) of ultrasonic sound % * Color-Sensor: % * DeviceMode.Color.Reflect *[Default]* + % *Output: value in range 0% to 100% brightness % * DeviceMode.Color.Ambient + % *Output: value in range 0% to 100% brightness % * DeviceMode.Color.Col + % *Output: none, black, blue, green. yellow, red, white, brown % * Gyro-Sensor: % * DeviceMode.Gyro.Angular *[Default]* % * DeviceMode.Gyro.Rate + % *Output: rotational speed [degree/s]. Expect small offset in resting position % * Infrared-Sensor: % * DeviceMode.InfraRed.Prox *[Default]* + % * Note: currently not recognized % * DeviceMode.InfraRed.Seek % * DeviceMode.InfraRed.Remote % * NXTColor-Sensor: % * DeviceMode.NXTColor.Reflect *[Default]* + % *Output: value in range 0% to 100% brightness % * DeviceMode.NXTColor.Ambient + % *Output: value in range 0% to 100% brightness % * DeviceMode.NXTColor.Color + % *Output: value representing color: + % 1 - black + % 2 - blue + % 3 - green + % 4 - yellow + % 5 - red + % 6 - white + % 7 - brown % * DeviceMode.NXTColor.Green + % *Output: value in range 0% to 100% of green reflectivityniedrige intensität farbe % * DeviceMode.NXTColor.Blue + % *Output: value in range 0% to 100% of blue reflectivity % * DeviceMode.NXTColor.Raw + % *Note: obsolete, functionality available in other modes. Also not working properly. Returning 1 value instead of 3 % * NXTLight-Sensor: % * DeviceMode.NXTLight.Reflect *[Default]* + % *Output: value in range 0% to 100% brightness % * DeviceMode.NXTLight.Ambient + % *Output: value in range 0% to 100% brightness % * NXTSound-Sensor: % * DeviceMode.NXTSound.DB *[Default]* + % *Output: value in decibel % * DeviceMode.NXTSound.DBA + % *Output: value in dba weighted according to human hearing % * NXTTemperature-Sensor % * DeviceMode.NXTTemperature.C *[Default]* % * DeviceMode.NXTTemperature.F % * NXTTouch-Sensor: % * DeviceMode.NXTTouch.Pushed *[Default]* + % *Output: 0: not pushed, 1: pushed % * DeviceMode.NXTTouch.Bumps + % *Output: n: number of times pressed and released % * NXTUltraSonic-Sensor: % * DeviceMode.NXTUltraSonic.CM *[Default]* + % *Output: distance in cm % * DeviceMode.NXTUltraSonic.IN + % *Output: distance in inches % * HTAccelerometer-Sensor: % * DeviceMode.HTAccelerometer.Acceleration *[Default]* % * DeviceMode.HTAccelerometer.AccelerationAllAxes + % *Note: Not working properly. Returning 1 value instead of 6 % * HTCompass-Sensor: % * DeviceMode.HTCompass.Degrees *[Default]* + % * Note: currently not recognized % * HTColor-Sensor: % * DeviceMode.HTColor.Col *[Default]* + % *Output: value representing color: + % 0 - black + % 1 - purple + % 2 - blue + % 3 - cyan + % 4 - green + % 5 - green/ yellow + % 6 - yellow + % 7 - orange + % 8 - red + % 9 - magenta + % 10 - pink + % 11 - low saturation blue + % 12 - low saturation green + % 13 - low saturation yellow + % 14 - low saturation orange + % 15 - low saturation red + % 16 - low saturation pink + % 17 - white % * DeviceMode.HTColor.Red + % *Output: value in range 0 to 255 of red reflectivity % * DeviceMode.HTColor.Green + % *Output: value in range 0 to 255 of green reflectivity % * DeviceMode.HTColor.Blue + % *Output: value in range 0 to 255 of blue reflectivity % * DeviceMode.HTColor.White + % *Output: value in range 0 to 255 of white reflectivity % * DeviceMode.HTColor.Raw - % * DeviceMode.HTColor.Nr, + % *Note: obsolete, color values available in other modes. Also not working properly. Returning 1 value instead of 3 + % * DeviceMode.HTColor.Nrm, + % *Note: obsolete, normalized values available in other modes. Also not working properly. Returning 1 value instead of 4 % * DeviceMode.HTColor.All + % *Note: obsolete, all values available in other modes. Also not working properly. Returning 1 value instead of 4 % debug (bool): Debug turned on or off. In debug mode, everytime a command is passed to % the sublayer ('communication layer'), there is feedback in the console about what % command has been called. *[WRITABLE]* @@ -100,7 +163,7 @@ classdef Sensor < MaskedHandle properties % Standard properties to be set by user % mode (DeviceMode.{Type}): Sensor mode in which the value will be read. By default, % mode is set to DeviceMode.Default.Undefined. Once a physical sensor is connected - % to the port *and* the physical Brick is connected to the EV3-object, the allowed + % to the port *and* the physical Brick is connected to the EV3-object afterwards, the allowed % mode and the default mode for a Sensor-object are the following (depending on the % sensor type): [WRITABLE] % @@ -289,11 +352,15 @@ classdef Sensor < MaskedHandle % mode (DeviceMode.{Type}): *[OPTIONAL]* % % Example: - % b = EV3(); % |br| - % b.connect('bt', 'serPort', '/dev/rfcomm0'); % |br| - % b.sensor1.setProperties('debug', 'on', 'mode', DeviceMode.Color.Ambient); % |br| - % % Instead of: b.sensor1.debug = 'on'; |br| - % % b.sensor1.mode = DeviceMode.Color.Ambient; |br| + % b = EV3(); |br| + % b.connect('bt', 'serPort', '/dev/rfcomm0'); |br| + % + % % use the following line: + % b.sensor1.setProperties('debug', 'on', 'mode', DeviceMode.Color.Ambient); |br| + % + % % Instead of: + % b.sensor1.debug = 'on'; |br| + % b.sensor1.mode = DeviceMode.Color.Ambient; |br| % p = inputParser(); @@ -464,4 +531,4 @@ classdef Sensor < MaskedHandle end end end -end +end \ No newline at end of file