mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[doc] Update Analog Input voltage to 3.3v (NFC) (#8085)
This commit is contained in:
@@ -129,7 +129,7 @@ public class AnalogJNI extends JNIWrapper {
|
||||
/**
|
||||
* Gets a sample straight from the channel on this module.
|
||||
*
|
||||
* <p>The sample is a 12-bit value representing the 0V to 5V range of the A/D converter in the
|
||||
* <p>The sample is a 12-bit value representing the 0V to 3.3V range of the A/D converter in the
|
||||
* module. The units are in A/D converter codes. Use GetVoltage() to get the analog value in
|
||||
* calibrated units.
|
||||
*
|
||||
|
||||
@@ -144,7 +144,7 @@ int32_t HAL_GetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
|
||||
/**
|
||||
* Gets a sample straight from the channel on this module.
|
||||
*
|
||||
* The sample is a 12-bit value representing the 0V to 5V range of the A/D
|
||||
* The sample is a 12-bit value representing the 0V to 3.3V range of the A/D
|
||||
* converter in the module. The units are in A/D converter codes. Use
|
||||
* GetVoltage() to get the analog value in calibrated units.
|
||||
*
|
||||
|
||||
@@ -44,7 +44,7 @@ class AnalogInput : public wpi::Sendable,
|
||||
/**
|
||||
* Get a sample straight from this channel.
|
||||
*
|
||||
* The sample is a 12-bit value representing the 0V to 5V range of the A/D
|
||||
* The sample is a 12-bit value representing the 0V to 3.3V range of the A/D
|
||||
* converter in the module. The units are in A/D converter codes. Use
|
||||
* GetVoltage() to get the analog value in calibrated units.
|
||||
*
|
||||
|
||||
@@ -38,7 +38,7 @@ class AnalogPotentiometer : public wpi::Sendable,
|
||||
* potentiometer is plugged into. 0-3 are on-board and 4-7
|
||||
* are on the MXP port.
|
||||
* @param fullRange The value (in desired units) representing the full
|
||||
* 0-5V range of the input.
|
||||
* 0-3.3V range of the input.
|
||||
* @param offset The value (in desired units) representing the
|
||||
* angular output at 0V.
|
||||
*/
|
||||
@@ -60,7 +60,7 @@ class AnalogPotentiometer : public wpi::Sendable,
|
||||
*
|
||||
* @param input The existing Analog Input pointer
|
||||
* @param fullRange The value (in desired units) representing the full
|
||||
* 0-5V range of the input.
|
||||
* 0-3.3V range of the input.
|
||||
* @param offset The value (in desired units) representing the
|
||||
* angular output at 0V.
|
||||
*/
|
||||
@@ -82,7 +82,7 @@ class AnalogPotentiometer : public wpi::Sendable,
|
||||
*
|
||||
* @param input The existing Analog Input pointer
|
||||
* @param fullRange The value (in desired units) representing the full
|
||||
* 0-5V range of the input.
|
||||
* 0-3.3V range of the input.
|
||||
* @param offset The value (in desired units) representing the
|
||||
* angular output at 0V.
|
||||
*/
|
||||
|
||||
@@ -52,9 +52,9 @@ class PotentiometerPIDTest : public testing::Test {
|
||||
m_elevatorSim.Update(20_ms);
|
||||
|
||||
/*
|
||||
meters = (v / 5v) * range
|
||||
meters / range = v / 5v
|
||||
5v * (meters / range) = v
|
||||
meters = (v / 3.3v) * range
|
||||
meters / range = v / 3.3v
|
||||
3.3v * (meters / range) = v
|
||||
*/
|
||||
m_analogSim.SetVoltage(
|
||||
(frc::RobotController::GetVoltage3V3() *
|
||||
|
||||
@@ -14,7 +14,7 @@ import edu.wpi.first.util.sendable.SendableRegistry;
|
||||
/**
|
||||
* Analog channel class.
|
||||
*
|
||||
* <p>Each analog channel is read from hardware as a 12-bit number representing 0V to 5V.
|
||||
* <p>Each analog channel is read from hardware as a 12-bit number representing 0V to 3.3V.
|
||||
*
|
||||
* <p>Connected to each analog channel is an averaging and oversampling engine. This engine
|
||||
* accumulates the specified ( by setAverageBits() and setOversampleBits() ) number of samples
|
||||
@@ -52,9 +52,9 @@ public class AnalogInput implements Sendable, AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a sample straight from this channel. The sample is a 12-bit value representing the 0V to 5V
|
||||
* range of the A/D converter. The units are in A/D converter codes. Use GetVoltage() to get the
|
||||
* analog value in calibrated units.
|
||||
* 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.
|
||||
*
|
||||
* @return A sample straight from this channel.
|
||||
*/
|
||||
|
||||
@@ -50,7 +50,7 @@ public class AnalogPotentiometer implements Sendable, AutoCloseable {
|
||||
* fraction of the supply voltage, plus the offset.
|
||||
*
|
||||
* @param input The {@link AnalogInput} this potentiometer is plugged into.
|
||||
* @param fullRange The angular value (in desired units) representing the full 0-5V range of the
|
||||
* @param fullRange The angular value (in desired units) representing the full 0-3.3V range of the
|
||||
* input.
|
||||
* @param offset The angular value (in desired units) representing the angular output at 0V.
|
||||
*/
|
||||
|
||||
@@ -81,7 +81,7 @@ class AnalogPotentiometerTest {
|
||||
RoboRioSim.resetData();
|
||||
AnalogInputSim sim = new AnalogInputSim(1);
|
||||
|
||||
// Test at 5v
|
||||
// Test at 3.3v
|
||||
sim.setVoltage(3.3);
|
||||
assertEquals(270, pot.get());
|
||||
|
||||
|
||||
@@ -68,9 +68,9 @@ class PotentiometerPIDTest {
|
||||
m_elevatorSim.update(0.02);
|
||||
|
||||
/*
|
||||
meters = (v / 5v) * range
|
||||
meters / range = v / 5v
|
||||
5v * (meters / range) = v
|
||||
meters = (v / 3.3v) * range
|
||||
meters / range = v / 3.3v
|
||||
3.3v * (meters / range) = v
|
||||
*/
|
||||
m_analogSim.setVoltage(
|
||||
RobotController.getVoltage3V3()
|
||||
|
||||
Reference in New Issue
Block a user