当前位置: 首页>>代码示例>>Java>>正文


Java Port.open方法代码示例

本文整理汇总了Java中lejos.hardware.port.Port.open方法的典型用法代码示例。如果您正苦于以下问题:Java Port.open方法的具体用法?Java Port.open怎么用?Java Port.open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lejos.hardware.port.Port的用法示例。


在下文中一共展示了Port.open方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resetMotors

import lejos.hardware.port.Port; //导入方法依赖的package包/类
/**
 * Reset all motors to zero power and float state
 * and reset tacho counts
 */
public static void resetMotors() {
    for ( String portName : new String[] {
        "A",
        "B",
        "C",
        "D"
    } ) {
        Port p = LocalEV3.get().getPort(portName);
        TachoMotorPort mp = p.open(TachoMotorPort.class);
        mp.controlMotor(0, BasicMotorPort.FLOAT);
        mp.resetTachoCount();
        mp.close();
    }
}
 
开发者ID:OpenRoberta,项目名称:robertalab-ev3lejos-v0,代码行数:19,代码来源:GraphicStartup.java

示例2: I2CSensor

import lejos.hardware.port.Port; //导入方法依赖的package包/类
/**
 * Create the sensor using the specified port. Configure the hardware as required.
 * @param port port the sensor is attached to
 * @param address I2C address
 * @param type type of I2C sensor
 */
public I2CSensor(Port port, int address, int type)
{
       this(port.open(I2CPort.class), address);
       releaseOnClose(this.port);
	// Set the EV3 pins up.
	if (type == TYPE_LOWSPEED_9V)
	    this.port.setPinMode(EV3SensorConstants.CMD_SET | EV3SensorConstants.CMD_PIN1);
	else
           this.port.setPinMode(EV3SensorConstants.CMD_SET);
}
 
开发者ID:SnakeSVx,项目名称:ev3,代码行数:17,代码来源:I2CSensor.java

示例3: NXTRegulatedMotor

import lejos.hardware.port.Port; //导入方法依赖的package包/类
/**
 * Use this constructor to assign a variable of type motor connected to a particular port.
 * @param port  to which this motor is connected
 */
public NXTRegulatedMotor(Port port)
{
    this(port.open(TachoMotorPort.class));
    releaseOnClose(tachoPort);
}
 
开发者ID:SnakeSVx,项目名称:ev3,代码行数:10,代码来源:NXTRegulatedMotor.java

示例4: RCXMotor

import lejos.hardware.port.Port; //导入方法依赖的package包/类
public RCXMotor(Port port)
{
    this(port.open(BasicMotorPort.class));
    releaseOnClose(this.port);
}
 
开发者ID:SnakeSVx,项目名称:ev3,代码行数:6,代码来源:RCXMotor.java

示例5: UARTSensor

import lejos.hardware.port.Port; //导入方法依赖的package包/类
/**
 * Create the sensor object and switch to the selected mode
 * @param port The port the sensor is attached to.
 * @param mode Operating mode for the sensor.
 */
public UARTSensor(Port port, int mode)
{
    this(port.open(UARTPort.class), mode);
    releaseOnClose(this.port);
}
 
开发者ID:SnakeSVx,项目名称:ev3,代码行数:11,代码来源:UARTSensor.java

示例6: AnalogSensor

import lejos.hardware.port.Port; //导入方法依赖的package包/类
public AnalogSensor(Port p)
{
    this(p.open(AnalogPort.class));
    releaseOnClose(this.port);
}
 
开发者ID:SnakeSVx,项目名称:ev3,代码行数:6,代码来源:AnalogSensor.java

示例7: NXTMotor

import lejos.hardware.port.Port; //导入方法依赖的package包/类
/**
 * Create an instance of a NXTMotor using the specified motor port and
 * PWM operating mode.
 * @param port The motor port that the motor will be attached to.
 * @param PWMMode see {@link lejos.hardware.port.BasicMotorPort#PWM_FLOAT} and see {@link lejos.hardware.port.BasicMotorPort#PWM_BRAKE}
 */
public NXTMotor(Port port, int PWMMode)
{
    this(port.open(TachoMotorPort.class), PWMMode);
    releaseOnClose(this.port);
}
 
开发者ID:SnakeSVx,项目名称:ev3,代码行数:12,代码来源:NXTMotor.java


注:本文中的lejos.hardware.port.Port.open方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。