public class MindSensorsNumPad extends I2CSensor
Modifier and Type | Field and Description |
---|---|
static int |
ERROR |
static int |
ID_HASH |
static int |
ID_KEY0 |
static int |
ID_KEY1 |
static int |
ID_KEY2 |
static int |
ID_KEY3 |
static int |
ID_KEY4 |
static int |
ID_KEY5 |
static int |
ID_KEY6 |
static int |
ID_KEY7 |
static int |
ID_KEY8 |
static int |
ID_KEY9 |
static int |
ID_STAR |
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION, retryCount
currentMode, modes
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 and Description |
---|
MindSensorsNumPad(I2CPort port)
Constructor for objects of the NumericPad of Mindsensors.
|
MindSensorsNumPad(Port port)
Constructor for objects of the NumericPad of Mindsensors.
|
Modifier and Type | Method and Description |
---|---|
void |
discardEvents()
This method discards any events.
|
protected void |
init() |
static java.lang.String |
maskToString(int x)
The lower 12 bits (Bits 0 to 11) are converted to a string
containing 0 to 9, *, and # depending on whether which of bits are set.
|
int |
readButtons()
Returns a Bitmask.
|
int |
waitForAnyEvent()
Waits for some button to be pressed or released.
|
int |
waitForAnyEvent(int timeout)
Waits for some button to be pressed or released.
|
int |
waitForAnyPress()
Waits for some button to be pressed.
|
int |
waitForAnyPress(int timeout)
Waits for some button to be pressed.
|
fetchString, getAddress, getData, getData, getPort, getProductID, getRetryCount, getVendorID, getVersion, sendData, sendData, sendData, setAddress, setRetryCount
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes
close, releaseOnClose
public static final int ERROR
public static final int ID_KEY0
public static final int ID_KEY1
public static final int ID_KEY2
public static final int ID_KEY3
public static final int ID_KEY4
public static final int ID_KEY5
public static final int ID_KEY6
public static final int ID_KEY7
public static final int ID_KEY8
public static final int ID_KEY9
public static final int ID_STAR
public static final int ID_HASH
public MindSensorsNumPad(I2CPort port)
port
- the port number (SensorPort.S1 ... SensorPort.S4) to which the
numeric pad is connected.public MindSensorsNumPad(Port port)
port
- the port number (SensorPort.S1 ... SensorPort.S4) to which the
numeric pad is connected.protected void init()
public int readButtons()
ERROR
if an I2C error has occuredpublic void discardEvents()
public int waitForAnyEvent()
public int waitForAnyEvent(int timeout)
timeout
- The maximum number of milliseconds to waitpublic int waitForAnyPress()
public int waitForAnyPress(int timeout)
timeout
- The maximum number of milliseconds to waitpublic static java.lang.String maskToString(int x)