lejos.nxt.addon
Class PFMate

java.lang.Object
  extended by lejos.nxt.I2CSensor
      extended by lejos.nxt.addon.PFMate
All Implemented Interfaces:
SensorConstants

public class PFMate
extends I2CSensor

Supports Mindsensors PF Mate
This device is used to control Lego Power Function IR receiver

Author:
Michael Smith

Field Summary
 PFMateMotor A
           
 PFMateMotor B
           
static int DEFAULT_PFMATE_ADDRESS
           
 
Fields inherited from class lejos.nxt.I2CSensor
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION
 
Fields inherited from interface lejos.nxt.SensorConstants
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, GREEN, GREEN_INDEX, MAX_AD_RAW, MAX_TYPE, MIN_TYPE, MODE_ANGLESTEP, MODE_BOOLEAN, MODE_CELSIUS, MODE_FARENHEIT, MODE_PCTFULLSCALE, MODE_PERIODCOUNTER, MODE_RAW, MODE_TRANSITIONCNT, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HISPEED, TYPE_LIGHT_ACTIVE, TYPE_LIGHT_INACTIVE, TYPE_LOWSPEED, TYPE_LOWSPEED_9V, TYPE_NO_SENSOR, TYPE_REFLECTION, TYPE_SOUND_DB, TYPE_SOUND_DBA, TYPE_SWITCH, TYPE_TEMPERATURE, WHITE, YELLOW
 
Constructor Summary
PFMate(I2CPort port, int channel)
          Constructor takes in the sensor port and the PF channel you will be using
PFMate(I2CPort port, int channel, int address)
          Constructor takes in the sensor port and the PF channel you will be using
 
Method Summary
 int getChannel()
          Returns the current IR channel in use by the PF Mate
 int getMotor()
          Returns which motors are activated
 void setChannel(int channel)
          Sets PF channel to use.
 void setMotor(int motor)
          Determines which motors are to be used buy default both are activated
 void update()
          Sends command to PF IR receiver to apply changes made to the registers.
 
Methods inherited from class lejos.nxt.I2CSensor
fetchString, getAddress, getData, getData, getPort, getProductID, getVendorID, getVersion, sendData, sendData, sendData, setAddress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

A

public PFMateMotor A

B

public PFMateMotor B

DEFAULT_PFMATE_ADDRESS

public static final int DEFAULT_PFMATE_ADDRESS
See Also:
Constant Field Values
Constructor Detail

PFMate

public PFMate(I2CPort port,
              int channel)
Constructor takes in the sensor port and the PF channel you will be using

Parameters:
port - sensor port
channel - PF Channel 1-4

PFMate

public PFMate(I2CPort port,
              int channel,
              int address)
Constructor takes in the sensor port and the PF channel you will be using

Parameters:
port - sensor port
channel - PF Channel 1-4
address - I2C address of the controller
Method Detail

update

public void update()
Sends command to PF IR receiver to apply changes made to the registers. Call this after You have set speed, direction and/or channel.


setChannel

public void setChannel(int channel)
Sets PF channel to use.

Parameters:
channel - 1-4

setMotor

public void setMotor(int motor)
Determines which motors are to be used buy default both are activated

Parameters:
motor - 0 both, 1 motor A or 2 motor B

getChannel

public int getChannel()
Returns the current IR channel in use by the PF Mate

Returns:
int 1-4

getMotor

public int getMotor()
Returns which motors are activated

Returns:
int 0 both, 1 motor A or 2 motor B