Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.wpi.first.wpilibj
Class SensorBase

    java.lang.Object
      edu.wpi.first.wpilibj.SensorBase

Direct Known Subclasses:
  Accelerometer, ADXL345_I2C, ADXL345_SPI, AnalogChannel, Compressor, Counter, DriverStationLCD, Encoder, Gyro, HiTechnicColorSensor, HiTechnicCompass, I2C, InterruptableSensorBase, Module, PWM, Relay, SolenoidBase, SPIDevice, Ultrasonic, Watchdog

    public abstract class SensorBase

extends Object

Base class for all sensors. Stores most recent status information as well as containing utility functions for checking channels and error processing.

Field Summary
`static int` | `kAnalogChannels` Number of analog channels per module
`static int` | `kAnalogModules` Number of analog modules
`static int` | `kDigitalChannels` Number of digital channels per digital sidecar
`static int` | `kPwmChannels` Number of PWM channels per sidecar
`static int` | `kRelayChannels` Number of relay channels per sidecar
`static int` | `kSolenoidChannels` Number of solenoid channels per module
`static int` | `kSolenoidModules` Number of analog modules
`static int` | `kSystemClockTicksPerMicrosecond` Ticks per microsecond

Constructor Summary
`SensorBase()` Creates an instance of the sensor base and gets an FPGA handle

Method Summary
`protected static void` | `checkAnalogChannel(int channel)` Check that the analog channel number is value.
`protected static void` | `checkAnalogModule(int moduleNumber)` Check that the analog module number is valid.
`protected static void` | `checkDigitalChannel(int channel)` Check that the digital channel number is valid.
`protected static void` | `checkDigitalModule(int moduleNumber)` Check that the digital module number is valid.
`protected static void` | `checkPWMChannel(int channel)` Check that the digital channel number is valid.
`protected static void` | `checkPWMModule(int moduleNumber)` Check that the digital module number is valid.
`protected static void` | `checkRelayChannel(int channel)` Check that the digital channel number is valid.
`protected static void` | `checkRelayModule(int moduleNumber)` Check that the digital module number is valid.
`protected static void` | `checkSolenoidChannel(int channel)` Verify that the solenoid channel number is within limits.
`protected static void` | `checkSolenoidModule(int moduleNumber)` Verify that the solenoid module is correct.
`void` | `free()` Free the resources used by this object
`static int` | `getDefaultAnalogModule()` Get the number of the default analog module.
`static int` | `getDefaultDigitalModule()` Get the number of the default analog module.
`static int` | `getDefaultSolenoidModule()` Get the number of the default analog module.
`static void` | `setDefaultAnalogModule(int moduleNumber)` Sets the default Analog module.
`static void` | `setDefaultDigitalModule(int moduleNumber)` Sets the default Digital Module.
`static void` | `setDefaultSolenoidModule(int moduleNumber)` Set the default location for the Solenoid (9472) module.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### kSystemClockTicksPerMicrosecond

    public static final int kSystemClockTicksPerMicrosecond

  Ticks per microsecond

  See Also:
    Constant Field Values

### kDigitalChannels

    public static final int kDigitalChannels

  Number of digital channels per digital sidecar

  See Also:
    Constant Field Values

### kAnalogChannels

    public static final int kAnalogChannels

  Number of analog channels per module

  See Also:
    Constant Field Values

### kAnalogModules

    public static final int kAnalogModules

  Number of analog modules

  See Also:
    Constant Field Values

### kSolenoidChannels

    public static final int kSolenoidChannels

  Number of solenoid channels per module

  See Also:
    Constant Field Values

### kSolenoidModules

    public static final int kSolenoidModules

  Number of analog modules

  See Also:
    Constant Field Values

### kPwmChannels

    public static final int kPwmChannels

  Number of PWM channels per sidecar

  See Also:
    Constant Field Values

### kRelayChannels

    public static final int kRelayChannels

  Number of relay channels per sidecar

  See Also:
    Constant Field Values

Constructor Detail

### SensorBase

    public SensorBase()

  Creates an instance of the sensor base and gets an FPGA handle

Method Detail

### setDefaultDigitalModule

    public static void setDefaultDigitalModule(int moduleNumber)

  Sets the default Digital Module. This sets the default digital module to use for objects that are created without specifying the digital module in the constructor. The default module is initialized to the first module in the chassis.

  Parameters:
    `moduleNumber` - The number of the digital module to use.

### setDefaultAnalogModule

    public static void setDefaultAnalogModule(int moduleNumber)

  Sets the default Analog module. This sets the default analog module to use for objects that are created without specifying the analog module in the constructor. The default module is initialized to the first module in the chassis.

  Parameters:
    `moduleNumber` - The number of the analog module to use.

### setDefaultSolenoidModule

    public static void setDefaultSolenoidModule(int moduleNumber)

  Set the default location for the Solenoid (9472) module.

  Parameters:
    `moduleNumber` - The number of the solenoid module to use.

### checkDigitalModule

    protected static void checkDigitalModule(int moduleNumber)

  Check that the digital module number is valid. Module numbers are 1 or 2 (they are no longer real cRIO slots).

  Parameters:
    `moduleNumber` - The digital module module number to check.

### checkRelayModule

    protected static void checkRelayModule(int moduleNumber)

  Check that the digital module number is valid. Module numbers are 1 or 2 (they are no longer real cRIO slots).

  Parameters:
    `moduleNumber` - The digital module module number to check.

### checkPWMModule

    protected static void checkPWMModule(int moduleNumber)

  Check that the digital module number is valid. Module numbers are 1 or 2 (they are no longer real cRIO slots).

  Parameters:
    `moduleNumber` - The digital module module number to check.

### checkAnalogModule

    protected static void checkAnalogModule(int moduleNumber)

  Check that the analog module number is valid. Module numbers are 1 or 2 (they are no longer real cRIO slots).

  Parameters:
    `moduleNumber` - The analog module module number to check.

### checkSolenoidModule

    protected static void checkSolenoidModule(int moduleNumber)

  Verify that the solenoid module is correct. Module numbers are 1 or 2 (they are no longer real cRIO slots).

  Parameters:
    `moduleNumber` - The solenoid module module number to check.

### checkDigitalChannel

    protected static void checkDigitalChannel(int channel)

  Check that the digital channel number is valid. Verify that the channel number is one of the legal channel numbers. Channel numbers are 1-based.

  Parameters:
    `channel` - The channel number to check.

### checkRelayChannel

    protected static void checkRelayChannel(int channel)

  Check that the digital channel number is valid. Verify that the channel number is one of the legal channel numbers. Channel numbers are 1-based.

  Parameters:
    `channel` - The channel number to check.

### checkPWMChannel

    protected static void checkPWMChannel(int channel)

  Check that the digital channel number is valid. Verify that the channel number is one of the legal channel numbers. Channel numbers are 1-based.

  Parameters:
    `channel` - The channel number to check.

### checkAnalogChannel

    protected static void checkAnalogChannel(int channel)

  Check that the analog channel number is value. Verify that the analog channel number is one of the legal channel numbers. Channel numbers are 1-based.

  Parameters:
    `channel` - The channel number to check.

### checkSolenoidChannel

    protected static void checkSolenoidChannel(int channel)

  Verify that the solenoid channel number is within limits. Channel numbers are 1-based.

  Parameters:
    `channel` - The channel number to check.

### getDefaultAnalogModule

    public static int getDefaultAnalogModule()

  Get the number of the default analog module.

  Returns:
    The number of the default analog module.

### getDefaultDigitalModule

    public static int getDefaultDigitalModule()

  Get the number of the default analog module.

  Returns:
    The number of the default analog module.

### getDefaultSolenoidModule

    public static int getDefaultSolenoidModule()

  Get the number of the default analog module.

  Returns:
    The number of the default analog module.

### free

    public void free()

  Free the resources used by this object

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

"
For updated information see the Java FRC site
"