ir_sensors Module

Files:

Interface

Function: IrSensorsInit
Arguments: None
Returns: Nothing
Initializes the ports for use with the IR emitting/detecting.

Function: GetSensorValue
Arguments: sensor: The sensor to read. Easiest to use constants in header file.
Returns: Constant indicating sensor status.
Gives whether the sensor is covered or uncovered.

Pseudo-Code

IrSensorsInit(Takes and returns nothing.)
  set the pin that controls the IR LEDs to hi
  set the data direction of the pin that controls the IR LEDs to write

  for each AD port:
    set the data direction to analog
  endfor
Note: In the final incarnation, this function is not used.
ToggleLeds(Takes a consant indicating which state to make the LEDs.)
  if passed-in state is ON:
    turn LED pin HI
  else if passed-in state is OFF:
    turn LED pin LO
  else if passed-in state is TOGGLE:
    toggle LED pin to the opposite of what it
      was previously
  endif
GetSensorValue(Takes a constant indicating which sensor to check.
               Returns a sensor state constant)
  store the value of the AD port for the passed-in sensor
  if the value is less than COVERED_THRESHOLD:
    return COVERED
  else:
    return UNCOVERED
  endif