Packageorg.MARS.robot.sensors
Classpublic class LineSensor
InheritanceLineSensor Inheritance AbstractSensor Inheritance AbstractElectronicDevice

The line sensor which uses IR light to locate the light or dark lines on the surface of the table.

See also

getReading()


Public Properties
 PropertyDefined by
 InheritednumberOfPorts : Number
Get the number of IO ports in the device.
AbstractElectronicDevice
 Inheritedshape : Shape
The shape of the sensor
AbstractSensor
 Inheritedtype : Class
The type of the sensor
AbstractSensor
Protected Properties
 PropertyDefined by
 Inherited_ports : Array
AbstractElectronicDevice
 Inherited_shape : Shape
AbstractSensor
 Inherited_type : Class
AbstractSensor
Public Methods
 MethodDefined by
  
LineSensor(x:Number, y:Number, size:Number = 5)
Creates a sensor with the given parameters.
LineSensor
 Inherited
getPort(portNumber:Number):IOPort
Get a certain IO port by its number
AbstractElectronicDevice
  
getReading():void
Determine if the sensor is on the line and set the output port accordingly: HIGH if the sensor is on the line and LOW if the sensor is off the line.
LineSensor
Constructor detail
LineSensor()constructor
public function LineSensor(x:Number, y:Number, size:Number = 5)

Creates a sensor with the given parameters.

NOTE: the shape of the sensing area of the line sensors such as QRD1114 is always a small square

Parameters
x:Number — - x coordinate relative to the center of the robot
 
y:Number — - y coordinate relative to the center of the robot
 
size:Number (default = 5) — - size of the sensor (5 by default)
Method detail
getReading()method
public override function getReading():void

Determine if the sensor is on the line and set the output port accordingly: HIGH if the sensor is on the line and LOW if the sensor is off the line.

See also

Environment.isOnLine()