Package lejos.hardware.device
Class PFMate
- java.lang.Object
-
- lejos.hardware.Device
-
- lejos.hardware.sensor.BaseSensor
-
- lejos.hardware.sensor.I2CSensor
-
- lejos.hardware.device.PFMate
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,SensorConstants,SensorMode,SensorModes,SampleProvider
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
Fields Modifier and Type Field Description PFMateMotorAPFMateMotorBstatic intDEFAULT_PFMATE_ADDRESS-
Fields inherited from class lejos.hardware.sensor.I2CSensor
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION, retryCount
-
Fields inherited from class lejos.hardware.sensor.BaseSensor
currentMode, modes
-
Fields inherited from interface lejos.hardware.sensor.SensorConstants
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, BROWN, GREEN, GREEN_INDEX, MAX_TYPE, MIN_TYPE, MODE_RAW, NXT_ADC_RES, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HIGHSPEED, TYPE_HIGHSPEED_9V, 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
Constructors Constructor Description PFMate(I2CPort port, int channel)Constructor takes in the sensor port and the PF channel you will be usingPFMate(I2CPort port, int channel, int address)Constructor takes in the sensor port and the PF channel you will be usingPFMate(Port port, int channel)Constructor takes in the sensor port and the PF channel you will be usingPFMate(Port port, int channel, int address)Constructor takes in the sensor port and the PF channel you will be using
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetChannel()Returns the current IR channel in use by the PF MateintgetMotor()Returns which motors are activatedvoidsetChannel(int channel)Sets PF channel to use.voidsetMotor(int motor)Determines which motors are to be used buy default both are activatedvoidupdate()Sends command to PF IR receiver to apply changes made to the registers.-
Methods inherited from class lejos.hardware.sensor.I2CSensor
fetchString, getAddress, getData, getData, getPort, getProductID, getRetryCount, getVendorID, getVersion, sendData, sendData, sendData, setAddress, setRetryCount
-
Methods inherited from class lejos.hardware.sensor.BaseSensor
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes
-
Methods inherited from class lejos.hardware.Device
close, releaseOnClose
-
-
-
-
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 portchannel- 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 portchannel- PF Channel 1-4address- I2C address of the controller
-
PFMate
public PFMate(Port port, int channel)
Constructor takes in the sensor port and the PF channel you will be using- Parameters:
port- sensor portchannel- PF Channel 1-4
-
PFMate
public PFMate(Port port, int channel, int address)
Constructor takes in the sensor port and the PF channel you will be using- Parameters:
port- sensor portchannel- PF Channel 1-4address- 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
-
-