Class AnalogInput
java.lang.Object
org.wpilib.hardware.discrete.AnalogInput
- All Implemented Interfaces:
AutoCloseable, Sendable
Analog channel class.
Each analog channel is read from hardware as a 12-bit number representing 0V to 3.3V.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intGet the channel number.intgetValue()Get a sample straight from this channel.doubleGet a scaled sample straight from this channel.voidinitSendable(SendableBuilder builder) Initializes thisSendableobject.voidsetSimDevice(SimDevice device) Indicates this input is used by a simulated device.
-
Constructor Details
-
AnalogInput
Construct an analog channel.- Parameters:
channel- The SmartIO channel for the analog input.
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable
-
getValue
Get a sample straight from this channel. The sample is a 12-bit value representing the 0V to 3.3V range of the A/D converter. The units are in A/D converter codes. Use GetVoltage() to get the analog value in calibrated units.- Returns:
- A sample straight from this channel.
-
getVoltage
Get a scaled sample straight from this channel. The value is scaled to units of Volts.- Returns:
- A scaled sample straight from this channel.
-
getChannel
-
setSimDevice
Indicates this input is used by a simulated device.- Parameters:
device- simulated device handle
-
initSendable
Description copied from interface:SendableInitializes thisSendableobject.- Specified by:
initSendablein interfaceSendable- Parameters:
builder- sendable builder
-