Packageorg.MARS.robot.control
Classpublic class IOPort

A simulation of the Input/Output port which is used for the communication between the various electronic devices.
The IO Ports could be used for either input or output.
Several IO Ports could be connected to each other to share their states.

See also

AbstractElectronicDevice
value


Public Properties
 PropertyDefined by
  connectedPorts : Array
[read-only] A list of all connected IO Ports
IOPort
  direction : Number
IOPort
  value : Boolean
[read-only] Gets a value of the port, dependin on its direction:
  • if the direction is INPUT, the value of the port is HIGH if and only if the value of the one of the connected OUTPUT ports is HIGH
  • if the direction is OUTPUT, the value is the one set by the high() or low() function by the controller
IOPort
Public Methods
 MethodDefined by
  
IOPort(direction:Number)
Create an IO Port with the given direction
IOPort
  
connectPorts(port:IOPort):void
Connect an IO port to the current port.
IOPort
  
high():void
Set a value of the output port to HIGH
IOPort
  
low():void
Set a value of the output port to LOW
IOPort
Public Constants
 ConstantDefined by
  HIGH : Boolean = true
[static]
IOPort
  INPUT : Number = 0
[static]
IOPort
  LOW : Boolean = false
[static]
IOPort
  OUTPUT : Number = 1
[static]
IOPort
Property detail
connectedPortsproperty
connectedPorts:Array  [read-only]

A list of all connected IO Ports

Implementation
    public function get connectedPorts():Array
directionproperty 
public var direction:Number
valueproperty 
value:Boolean  [read-only]

Gets a value of the port, dependin on its direction:

Implementation
    public function get value():Boolean
Constructor detail
IOPort()constructor
public function IOPort(direction:Number)

Create an IO Port with the given direction

Parameters
direction:Number
Method detail
connectPorts()method
public function connectPorts(port:IOPort):void

Connect an IO port to the current port.

NOTE: since every port contains a list of the connected ports connecting two ports of the same direction is not allowed due to the danger of an infinite loop.

Parameters
port:IOPort — - target IO Port

Throws
— Error whenever two ports of the same direction are attempted to be connected

See also

high()method 
public function high():void

Set a value of the output port to HIGH


Throws
— Error whenever the input port direction is attempted to be set
low()method 
public function low():void

Set a value of the output port to LOW


Throws
— Error whenever the input port direction is attempted to be set
Constant detail
HIGHconstant
public static const HIGH:Boolean = true
INPUTconstant 
public static const INPUT:Number = 0
LOWconstant 
public static const LOW:Boolean = false
OUTPUTconstant 
public static const OUTPUT:Number = 1