本文整理汇总了Java中edu.wpi.first.wpilibj.AnalogModule类的典型用法代码示例。如果您正苦于以下问题:Java AnalogModule类的具体用法?Java AnalogModule怎么用?Java AnalogModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnalogModule类属于edu.wpi.first.wpilibj包,在下文中一共展示了AnalogModule类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: AbsoluteAnalogEncoder
import edu.wpi.first.wpilibj.AnalogModule; //导入依赖的package包/类
public AbsoluteAnalogEncoder(int channel, double minVoltage, double maxVoltage, double offsetDegrees, int analogSampleRate, double analogTriggerThresholdDifference) { //TODO: Implement direction
super(channel);
_channel = channel;
if (minVoltage >= maxVoltage) throw new IllegalArgumentException("Minimum voltage must be less than maximum voltage");
if (offsetDegrees < 0 || offsetDegrees > 360) throw new IllegalArgumentException("Offset must be between 0 and 360 degrees");
// Initialize analog trigger //
_analogTrigger = new AnalogTrigger(channel);
_analogTrigger.setFiltered(true);
_analogTrigger.setLimitsVoltage(minVoltage + analogTriggerThresholdDifference, maxVoltage - analogTriggerThresholdDifference);
AnalogTriggerOutput _analogTriggerFalling = new AnalogTriggerOutput(_analogTrigger, AnalogTriggerOutput.Type.kFallingPulse);
AnalogTriggerOutput _analogTriggerRising = new AnalogTriggerOutput(_analogTrigger, AnalogTriggerOutput.Type.kRisingPulse);
// Set analog module sampling rate //
AnalogModule module = (AnalogModule) Module.getModule(ModulePresence.ModuleType.kAnalog, DEFAULT_ANALOG_MODULE);
module.setSampleRate(analogSampleRate);
// Initialize turn counter //
_turnCounter = new Counter();
_turnCounter.setUpDownCounterMode();
_turnCounter.setUpSource(_analogTriggerRising);
_turnCounter.setDownSource(_analogTriggerFalling);
_turnCounter.start();
_minVoltage = minVoltage;
_maxVoltage = maxVoltage;
_offsetDegrees = offsetDegrees;
}
开发者ID:Whillikers,项目名称:SwerveDrive,代码行数:29,代码来源:AbsoluteAnalogEncoder.java
示例2: createAnalogPacket
import edu.wpi.first.wpilibj.AnalogModule; //导入依赖的package包/类
private static byte [] createAnalogPacket(int module) {
byte [] data = new byte[9 + headerSize];
generateHeader(data, 0, headerSize, 1);
data[headerSize] = (byte)module;
for (int i = 0; i < 8; i++) {
data[i+headerSize+1] = (byte)(5 / AnalogModule.getInstance(module).getVoltage(i+1) * 255);
// data[i+headerSize+1] = 0;
}
return data;
}
开发者ID:Team-2502,项目名称:RobotCode2014,代码行数:11,代码来源:BlackBoxSubPacket.java
示例3: UltraSonicSensor
import edu.wpi.first.wpilibj.AnalogModule; //导入依赖的package包/类
/**
* Constructor that uses the default module slot
*
* @param analogChannel channel the ultrasonic sensor is connected to on the
* cRIO 9201 module.
*/
public UltraSonicSensor(int analogChannel)
{
channel = analogChannel;
ultrasonicSensor = AnalogModule.getInstance(1);
}
开发者ID:FIRST-FRC-Team-2028,项目名称:2012,代码行数:12,代码来源:UltraSonicSensor.java
示例4: Ultrasonic
import edu.wpi.first.wpilibj.AnalogModule; //导入依赖的package包/类
/**
* Constructor that uses the default module slot
*
* @param analogChannel channel the ultrasonic sensor is connected to on the
* cRIO 9201 module.
*/
public Ultrasonic(int analogChannel) {
channel = analogChannel;
ultrasonicSensor = AnalogModule.getInstance(1);
}
开发者ID:FIRST-FRC-Team-2028,项目名称:2013,代码行数:11,代码来源:Ultrasonic.java
注:本文中的edu.wpi.first.wpilibj.AnalogModule类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论