當前位置: 首頁>>代碼示例>>Java>>正文


Java AnalogTriggerOutput類代碼示例

本文整理匯總了Java中edu.wpi.first.wpilibj.AnalogTriggerOutput的典型用法代碼示例。如果您正苦於以下問題:Java AnalogTriggerOutput類的具體用法?Java AnalogTriggerOutput怎麽用?Java AnalogTriggerOutput使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AnalogTriggerOutput類屬於edu.wpi.first.wpilibj包,在下文中一共展示了AnalogTriggerOutput類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: AbsoluteAnalogEncoder

import edu.wpi.first.wpilibj.AnalogTriggerOutput; //導入依賴的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: AnalogChannelVolt

import edu.wpi.first.wpilibj.AnalogTriggerOutput; //導入依賴的package包/類
public AnalogChannelVolt(int moduleNumber, int channel) {
    super(moduleNumber, channel);

    this.getModule().setSampleRate(1000);

    m_trig = new AnalogTrigger(moduleNumber, channel);
    m_trig.setFiltered(true);
    m_trig.setLimitsVoltage(1.35, 3.65);

    m_count = new Counter();
    m_count.setUpDownCounterMode();
    m_count.setUpSource(m_trig, AnalogTriggerOutput.Type.kFallingPulse);
    m_count.setDownSource(m_trig, AnalogTriggerOutput.Type.kRisingPulse);
    m_count.start();
}
 
開發者ID:FRC-Team-4143,項目名稱:SwerveDriveTest,代碼行數:16,代碼來源:AnalogChannelVolt.java


注:本文中的edu.wpi.first.wpilibj.AnalogTriggerOutput類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。