本文整理匯總了Java中edu.wpi.first.wpilibj.Relay.Value方法的典型用法代碼示例。如果您正苦於以下問題:Java Relay.Value方法的具體用法?Java Relay.Value怎麽用?Java Relay.Value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類edu.wpi.first.wpilibj.Relay
的用法示例。
在下文中一共展示了Relay.Value方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: tick
import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
@Override
public void tick() {
double horizontalRotationDegrees = (double) this.getDataKey(CameraSubsystemDataKey.HORIZONTAL_ROTATION_DEGREES);
double verticalRotationDegrees = (double) this.getDataKey(CameraSubsystemDataKey.VERTICAL_ROTATION_DEGREES);
double horizontalValue = WarriorMath.map(horizontalDegrees[1], horizontalDegrees[0], horizontalRotationDegrees, 0.0, 1.0);
double verticalValue = WarriorMath.map(verticalDegrees[1], verticalDegrees[0], verticalRotationDegrees, 0.0, 1.0);
Relay.Value lightsValue = null;
if((boolean) this.getDataKey(CameraSubsystemDataKey.LIGHTS) == true) {
lightsValue = Relay.Value.kOn;
} else {
lightsValue = Relay.Value.kOff;
}
this._horizontal.set(horizontalValue);
this._vertical.set(verticalValue);
this._lights.set(lightsValue);
}
示例2: setForward
import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
/**
* Set the state of the forward channel.
* The innermost pin (A) on the Relay connector is "forward".
* This method will not affect the state of the reverse channel.
*
* @param val true if on, false if off
*/
public void setForward(boolean fwdVal) {
Relay.Value currentValue = this.get(),
newValue = currentValue;
if(currentValue == Relay.Value.kForward) {
if(!fwdVal)
newValue = Relay.Value.kOff;
} else if(currentValue == Relay.Value.kOff) {
if(fwdVal)
newValue = Relay.Value.kForward;
} else if(currentValue == Relay.Value.kOn) {
if(!fwdVal)
newValue = Relay.Value.kReverse;
} else if(currentValue == Relay.Value.kReverse) {
if(fwdVal)
newValue = Relay.Value.kOn;
}
this.set(newValue);
}
示例3: setReverse
import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
/**
* Set the state of the reverse channel.
* The center pin (B) on the Relay connector is "reverse".
* This method will not affect the state of the forward channel.
*
* @param val true if on, false if off
*/
public void setReverse(boolean revVal) {
Relay.Value currentValue = this.get(),
newValue = currentValue;
if(currentValue == Relay.Value.kForward) {
if(revVal)
newValue = Relay.Value.kOn;
} else if(currentValue == Relay.Value.kOff) {
if(revVal)
newValue = Relay.Value.kReverse;
} else if(currentValue == Relay.Value.kOn) {
if(!revVal)
newValue = Relay.Value.kForward;
} else if(currentValue == Relay.Value.kReverse) {
if(!revVal)
newValue = Relay.Value.kOff;
}
this.set(newValue);
}
示例4: set
import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
public void set(boolean pRelayState) {
boolean leftRelayState;
boolean rightRelayState;
Relay.Value currentValue = relay.get();
/* Get left and right relay states */
if (relaySide == LEFT_RELAY) {
leftRelayState = pRelayState;
rightRelayState = (currentValue.equals(Relay.Value.kOn) || currentValue.equals(Relay.Value.kReverse));
}
else {
leftRelayState = (currentValue.equals(Relay.Value.kOn) || currentValue.equals(Relay.Value.kForward));
rightRelayState = pRelayState;
}
/* Set relay to left and right relay states */
if (leftRelayState) {
if (rightRelayState) {
relay.set(Relay.Value.kOn);
}
else {
relay.set(Relay.Value.kForward);
}
}
else if (rightRelayState) {
relay.set(Relay.Value.kReverse);
}
else {
relay.set(Relay.Value.kOff);
}
}
示例5: get
import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
public Relay.Value get() {
return relay.get();
}
示例6: setRelayValues
import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
/**
* @param set
* relay values
*/
public void setRelayValues(Relay.Value relayOne, Relay.Value relayTwo) {
this.relayOne.set(relayOne);
this.relayTwo.set(relayTwo);
}
示例7: intakeLiftState
import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
public Relay.Value intakeLiftState(){
return intakeLift.get();
}
示例8: getPosition
import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
/**
* This method no matter what state the switch is in, and uses the values found
* in the
* WPI Relay class' enum "Value" for compatibility. If the state of the first
* port
* the switch is plugged into is "on," and the state of the second port the
* switch is
* plugged into is "off," the method returns the "kForward". If the reverse is
* true,
* the method returns "kReverse". If both are off (the switch is in its center
* position), the method return "kOff". This does not make use of the
* Relay.Value.kOn
* value.
*
* @return The state of the switch. Either "kForward", "kReverse", or "kOff".
* @author Alex Kneipp
* @written Jan 18, 2016
*/
public Relay.Value getPosition ()
{
if (switch1.isOn())
return Relay.Value.kForward;
else if (switch2.isOn())
return Relay.Value.kReverse;
else
return Relay.Value.kOff;
}
示例9: setRelayValues
import edu.wpi.first.wpilibj.Relay; //導入方法依賴的package包/類
/**
* set relay values
* @param relayOne the value to set the first relay to
* @param relayTwo the value to set the second relay to
*/
public void setRelayValues(Relay.Value relayOne, Relay.Value relayTwo) {
this.relayOne.set(relayOne);
this.relayTwo.set(relayTwo);
}