icommand.nxt
Class SensorPort

java.lang.Object
  extended by icommand.nxt.SensorPort
All Implemented Interfaces:
NXTProtocol

public class SensorPort
extends java.lang.Object
implements NXTProtocol

Port class. Contains 4 Port instances.
Usage: Port.S4.readValue();

Version:
0.3 29-October-2006
Author:
Brian Bagnall

Field Summary
static SensorPort S1
           
static SensorPort S2
           
static SensorPort S3
           
static SensorPort S4
           
 
Fields inherited from interface icommand.nxt.comm.NXTProtocol
ANGLE, ANGLESTEPSMODE, BOOLEANMODE, BOOT, BRAKE, CELSIUSMODE, CLOSE, CUSTOM, DELETE, DELETE_USER_FLASH, DIRECT_COMMAND_NOREPLY, DIRECT_COMMAND_REPLY, FAHRENHEITMODE, FIND_FIRST, FIND_NEXT, GET_BATTERY_LEVEL, GET_CURRENT_PROGRAM_NAME, GET_DEVICE_INFO, GET_FIRMWARE_VERSION, GET_INPUT_VALUES, GET_OUTPUT_STATE, HIGH_SPEED_BUFFER, KEEP_ALIVE, LIGHT_ACTIVE, LIGHT_INACTIVE, LOWSPEED, LOWSPEED_9V, LS_GET_STATUS, LS_READ, LS_WRITE, MESSAGE_READ, MESSAGE_WRITE, MODEMASK, MOTOR_RUN_STATE_IDLE, MOTOR_RUN_STATE_RAMPDOWN, MOTOR_RUN_STATE_RAMPUP, MOTOR_RUN_STATE_RUNNING, MOTORON, NO_OF_SENSOR_TYPES, NO_SENSOR, NXJ_DEFRAG, NXJ_DISCONNECT, OPEN_APPEND_DATA, OPEN_READ, OPEN_READ_LINEAR, OPEN_WRITE, OPEN_WRITE_DATA, OPEN_WRITE_LINEAR, PCTFULLSCALEMODE, PERIODCOUNTERMODE, PLAY_SOUND_FILE, PLAY_TONE, POLL, POLL_BUFFER, POLL_LENGTH, RAWMODE, READ, REFLECTION, REGULATED, REGULATION_MODE_IDLE, REGULATION_MODE_MOTOR_SPEED, REGULATION_MODE_MOTOR_SYNC, REPLY_COMMAND, RESET_MOTOR_POSITION, RESET_SCALED_INPUT_VALUE, SET_BRICK_NAME, SET_INPUT_MODE, SET_OUTPUT_STATE, SLOPEMASK, SOUND_DB, SOUND_DBA, START_PROGRAM, STOP_PROGRAM, STOP_SOUND_PLAYBACK, SWITCH, SYSTEM_COMMAND_NOREPLY, SYSTEM_COMMAND_REPLY, TEMPERATURE, TRANSITIONCNTMODE, WRITE
 
Method Summary
 int getId()
           
 boolean readBooleanValue()
          Reads the boolean value of the sensor.
 int readNormalizedValue()
          Reads the normalized value of the sensor.
 int readRawValue()
          Reads the raw value of the sensor.
 int readScaledValue()
          Returns scaled value, depending on mode of sensor.
 void setTypeAndMode(int type, int mode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

S1

public static SensorPort S1

S2

public static SensorPort S2

S3

public static SensorPort S3

S4

public static SensorPort S4
Method Detail

getId

public int getId()

setTypeAndMode

public void setTypeAndMode(int type,
                           int mode)

readBooleanValue

public boolean readBooleanValue()
Reads the boolean value of the sensor.

Returns:
Boolean value of sensor.

readRawValue

public int readRawValue()
Reads the raw value of the sensor.

Returns:
Raw sensor value. Range is device dependent.

readNormalizedValue

public int readNormalizedValue()
Reads the normalized value of the sensor.

Returns:
Normalized value. 0 to 1023

readScaledValue

public int readScaledValue()
Returns scaled value, depending on mode of sensor. e.g. BOOLEANMODE returns 0 or 1. e.g. PCTFULLSCALE returns 0 to 100.

Returns:
See Also:
setTypeAndMode(int, int)


Copyright 2006. All Rights Reserved.