本文整理汇总了Java中com.qualcomm.robotcore.hardware.DigitalChannel类的典型用法代码示例。如果您正苦于以下问题:Java DigitalChannel类的具体用法?Java DigitalChannel怎么用?Java DigitalChannel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DigitalChannel类属于com.qualcomm.robotcore.hardware包,在下文中一共展示了DigitalChannel类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: FtcDigitalInput
import com.qualcomm.robotcore.hardware.DigitalChannel; //导入依赖的package包/类
/**
* Constructor: Creates an instance of the object.
*
* @param hardwareMap specifies the global hardware map.
* @param instanceName specifies the instance name.
*/
public FtcDigitalInput(HardwareMap hardwareMap, String instanceName)
{
super(instanceName);
if (debugEnabled)
{
dbgTrace = new TrcDbgTrace(moduleName + "." + instanceName, tracingEnabled, traceLevel, msgLevel);
}
digitalInput = hardwareMap.get(DigitalChannel.class, instanceName);
digitalInput.setMode(DigitalChannel.Mode.INPUT);
}
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:19,代码来源:FtcDigitalInput.java示例2: FtcDigitalOutput
import com.qualcomm.robotcore.hardware.DigitalChannel; //导入依赖的package包/类
/**
* Constructor: Creates an instance of the object.
*
* @param hardwareMap specifies the global hardware map.
* @param instanceName specifies the instance name.
*/
public FtcDigitalOutput(HardwareMap hardwareMap, String instanceName)
{
super(instanceName);
if (debugEnabled)
{
dbgTrace = new TrcDbgTrace(moduleName + "." + instanceName, tracingEnabled, traceLevel, msgLevel);
}
digitalOutput = hardwareMap.get(DigitalChannel.class, instanceName);
digitalOutput.setMode(DigitalChannel.Mode.OUTPUT);
}
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:19,代码来源:FtcDigitalOutput.java示例3: runOpMode
import com.qualcomm.robotcore.hardware.DigitalChannel; //导入依赖的package包/类
@Override
public void runOpMode() {
// get a reference to our digitalTouch object.
digitalTouch = hardwareMap.get(DigitalChannel.class, "sensor_digital");
// set the digital channel to input.
digitalTouch.setMode(DigitalChannel.Mode.INPUT);
// wait for the start button to be pressed.
waitForStart();
// while the op mode is active, loop and read the light levels.
// Note we use opModeIsActive() as our loop condition because it is an interruptible method.
while (opModeIsActive()) {
// send the info back to driver station using telemetry function.
// if the digital channel returns true it's HIGH and the button is unpressed.
if (digitalTouch.getState() == true) {
telemetry.addData("Digital Touch", "Is Not Pressed");
} else {
telemetry.addData("Digital Touch", "Is Pressed");
}
telemetry.update();
}
}
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:28,代码来源:SensorDigitalTouch.java示例4: digital
import com.qualcomm.robotcore.hardware.DigitalChannel; //导入依赖的package包/类
/**
* wrap a DigitalChannel in a DigitalSensor
*
* @param digitalChannel the input to wrap
* @return the created DigitalSensor
*/
public static DigitalSensor digital(final DigitalChannel digitalChannel) {
digitalChannel.setMode(DigitalChannelController.Mode.INPUT);
return new DigitalSensor() {
@Override
public Boolean getValue() {
return digitalChannel.getState();
}
};
}
开发者ID:FTC7393,项目名称:EVLib,代码行数:17,代码来源:Sensors.java示例5: createDeviceMaps
import com.qualcomm.robotcore.hardware.DigitalChannel; //导入依赖的package包/类
/**
* Move the propriety {@link HardwareMap.DeviceMapping} to our {@link DeviceMap} for our
* internal use
*/
private void createDeviceMaps() {
fullMap.checkedPut(DcMotorController.class, new DeviceMap<>(basicMap.dcMotorController));
fullMap.checkedPut(DcMotor.class, new DeviceMap<>(basicMap.dcMotor));
fullMap.checkedPut(ServoController.class, new DeviceMap<>(basicMap.servoController));
fullMap.checkedPut(Servo.class, new DeviceMap<>(basicMap.servo));
fullMap.checkedPut(LegacyModule.class, new DeviceMap<>(basicMap.legacyModule));
fullMap.checkedPut(TouchSensorMultiplexer.class, new DeviceMap<>(basicMap.touchSensorMultiplexer));
fullMap.checkedPut(DeviceInterfaceModule.class, new DeviceMap<>(basicMap.deviceInterfaceModule));
fullMap.checkedPut(AnalogInput.class, new DeviceMap<>(basicMap.analogInput));
fullMap.checkedPut(DigitalChannel.class, new DeviceMap<>(basicMap.digitalChannel));
fullMap.checkedPut(OpticalDistanceSensor.class, new DeviceMap<>(basicMap.opticalDistanceSensor));
fullMap.checkedPut(TouchSensor.class, new DeviceMap<>(basicMap.touchSensor));
fullMap.checkedPut(PWMOutput.class, new DeviceMap<>(basicMap.pwmOutput));
fullMap.checkedPut(I2cDevice.class, new DeviceMap<>(basicMap.i2cDevice));
fullMap.checkedPut(AnalogOutput.class, new DeviceMap<>(basicMap.analogOutput));
fullMap.checkedPut(ColorSensor.class, new DeviceMap<>(basicMap.colorSensor));
fullMap.checkedPut(LED.class, new DeviceMap<>(basicMap.led));
fullMap.checkedPut(AccelerationSensor.class, new DeviceMap<>(basicMap.accelerationSensor));
fullMap.checkedPut(CompassSensor.class, new DeviceMap<>(basicMap.compassSensor));
fullMap.checkedPut(GyroSensor.class, new DeviceMap<>(basicMap.gyroSensor));
fullMap.checkedPut(IrSeekerSensor.class, new DeviceMap<>(basicMap.irSeekerSensor));
fullMap.checkedPut(LightSensor.class, new DeviceMap<>(basicMap.lightSensor));
fullMap.checkedPut(UltrasonicSensor.class, new DeviceMap<>(basicMap.ultrasonicSensor));
fullMap.checkedPut(VoltageSensor.class, new DeviceMap<>(basicMap.voltageSensor));
LinkedHashMultimap<DcMotorController, DcMotor> multimap = LinkedHashMultimap.create();
for (DcMotor motor : dcMotors()) {
multimap.put(motor.getController(), motor);
}
}
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:35,代码来源:ExtensibleHardwareMap.java示例6: runOpMode
import com.qualcomm.robotcore.hardware.DigitalChannel; //导入依赖的package包/类
@Override
public void runOpMode() {
boolean inputPin; // Input State
boolean outputPin; // Output State
DeviceInterfaceModule dim; // Device Object
DigitalChannel digIn; // Device Object
DigitalChannel digOut; // Device Object
// get a reference to a Modern Robotics DIM, and IO channels.
dim = hardwareMap.get(DeviceInterfaceModule.class, "dim"); // Use generic form of device mapping
digIn = hardwareMap.get(DigitalChannel.class, "digin"); // Use generic form of device mapping
digOut = hardwareMap.get(DigitalChannel.class, "digout"); // Use generic form of device mapping
digIn.setMode(DigitalChannelController.Mode.INPUT); // Set the direction of each channel
digOut.setMode(DigitalChannelController.Mode.OUTPUT);
// wait for the start button to be pressed.
telemetry.addData(">", "Press play, and then user X button to set DigOut");
telemetry.update();
waitForStart();
while (opModeIsActive()) {
outputPin = gamepad1.x ; // Set the output pin based on x button
digOut.setState(outputPin);
inputPin = digIn.getState(); // Read the input pin
// Display input pin state on LEDs
if (inputPin) {
dim.setLED(RED_LED_CHANNEL, true);
dim.setLED(BLUE_LED_CHANNEL, false);
}
else {
dim.setLED(RED_LED_CHANNEL, false);
dim.setLED(BLUE_LED_CHANNEL, true);
}
telemetry.addData("Output", outputPin );
telemetry.addData("Input", inputPin );
telemetry.addData("LED", inputPin ? "Red" : "Blue" );
telemetry.update();
}
}
开发者ID:ykarim,项目名称:FTC2016,代码行数:45,代码来源:SensorDIO.java示例7: runOpMode
import com.qualcomm.robotcore.hardware.DigitalChannel; //导入依赖的package包/类
@Override
public void runOpMode() {
boolean inputPin; // Input State
boolean outputPin; // Output State
DeviceInterfaceModule dim; // Device Object
DigitalChannel digIn; // Device Object
DigitalChannel digOut; // Device Object
// get a reference to a Modern Robotics DIM, and IO channels.
dim = hardwareMap.get(DeviceInterfaceModule.class, "dim"); // Use generic form of device mapping
digIn = hardwareMap.get(DigitalChannel.class, "digin"); // Use generic form of device mapping
digOut = hardwareMap.get(DigitalChannel.class, "digout"); // Use generic form of device mapping
digIn.setMode(DigitalChannel.Mode.INPUT); // Set the direction of each channel
digOut.setMode(DigitalChannel.Mode.OUTPUT);
// wait for the start button to be pressed.
telemetry.addData(">", "Press play, and then user X button to set DigOut");
telemetry.update();
waitForStart();
while (opModeIsActive()) {
outputPin = gamepad1.x ; // Set the output pin based on x button
digOut.setState(outputPin);
inputPin = digIn.getState(); // Read the input pin
// Display input pin state on LEDs
if (inputPin) {
dim.setLED(RED_LED_CHANNEL, true);
dim.setLED(BLUE_LED_CHANNEL, false);
}
else {
dim.setLED(RED_LED_CHANNEL, false);
dim.setLED(BLUE_LED_CHANNEL, true);
}
telemetry.addData("Output", outputPin );
telemetry.addData("Input", inputPin );
telemetry.addData("LED", inputPin ? "Red" : "Blue" );
telemetry.update();
}
}
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:45,代码来源:SensorDIO.java示例8: mapDigitalDevice
import com.qualcomm.robotcore.hardware.DigitalChannel; //导入依赖的package包/类
private void mapDigitalDevice(HardwareMap map, DeviceManager deviceMgr, DeviceInterfaceModule deviceInterfaceModule, DeviceConfiguration devConf) {
if (!devConf.isEnabled()) return;
DigitalChannel digitalChannel = deviceMgr.createDigitalChannelDevice(deviceInterfaceModule, devConf.getPort());
map.digitalChannel.put(devConf.getName(), digitalChannel);
}
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:6,代码来源:XtensibleEventLoop.java示例9: runOpMode
import com.qualcomm.robotcore.hardware.DigitalChannel; //导入依赖的package包/类
@Override
public void runOpMode() throws InterruptedException {
boolean inputPin; // Input State
boolean outputPin; // Output State
DeviceInterfaceModule dim; // Device Object
DigitalChannel digIn; // Device Object
DigitalChannel digOut; // Device Object
// get a reference to a Modern Robotics DIM, and IO channels.
dim = hardwareMap.get(DeviceInterfaceModule.class, "dim"); // Use generic form of device mapping
digIn = hardwareMap.get(DigitalChannel.class, "digin"); // Use generic form of device mapping
digOut = hardwareMap.get(DigitalChannel.class, "digout"); // Use generic form of device mapping
digIn.setMode(DigitalChannelController.Mode.INPUT); // Set the direction of each channel
digOut.setMode(DigitalChannelController.Mode.OUTPUT);
// wait for the start button to be pressed.
telemetry.addData(">", "Press play, and then user X button to set DigOut");
telemetry.update();
waitForStart();
while (opModeIsActive()) {
outputPin = gamepad1.x; // Set the output pin based on x button
digOut.setState(outputPin);
inputPin = digIn.getState(); // READ the input pin
// Display input pin state on LEDs
if (inputPin) {
dim.setLED(RED_LED_CHANNEL, true);
dim.setLED(BLUE_LED_CHANNEL, false);
} else {
dim.setLED(RED_LED_CHANNEL, false);
dim.setLED(BLUE_LED_CHANNEL, true);
}
telemetry.addData("Output", outputPin);
telemetry.addData("Input", inputPin);
telemetry.addData("LED", inputPin ? "Red" : "Blue");
telemetry.update();
}
}
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:44,代码来源:SensorDIO.java示例10: combinedFwdInv
import com.qualcomm.robotcore.hardware.DigitalChannel; //导入依赖的package包/类
/**
* combines two inputs that are attached to the same switch so that when one is pressed, the other is not
*
* @param digitalChannel the input that has the polarity that the output should have
* @param digitalChannelInv the input that has opposite polarity
* @return the combined DigitalSensor
*/
public static DigitalSensor combinedFwdInv(DigitalChannel digitalChannel, DigitalChannel digitalChannelInv) {
return combinedFwdInv(digital(digitalChannel), digital(digitalChannelInv));
}
开发者ID:FTC7393,项目名称:EVLib,代码行数:11,代码来源:Sensors.java示例11: digitalChannels
import com.qualcomm.robotcore.hardware.DigitalChannel; //导入依赖的package包/类
/**
* Returns a {@link DeviceMap<DigitalChannel>} for use to access Digital Channel hardware
*
* @return a DeviceMap to use for access to representations of Digital Channels
* @see DeviceMap
* @see DigitalChannel
*/
public DeviceMap<DigitalChannel> digitalChannels() {
return fullMap.checkedGet(DigitalChannel.class);
}
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:11,代码来源:ExtensibleHardwareMap.java本文标签属性:
示例:示例英语
代码:代码转换器
java:java游戏
DigitalChannel:digitalchanneldc122