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


Java EV3MediumRegulatedMotor类代码示例

本文整理汇总了Java中lejos.hardware.motor.EV3MediumRegulatedMotor的典型用法代码示例。如果您正苦于以下问题:Java EV3MediumRegulatedMotor类的具体用法?Java EV3MediumRegulatedMotor怎么用?Java EV3MediumRegulatedMotor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: initRegulatedMotor

import lejos.hardware.motor.EV3MediumRegulatedMotor; //导入依赖的package包/类
private void initRegulatedMotor(ActorPort actorPort, Actor actorType, Port hardwarePort) {
    this.lcd.clear();
    // Hal.formatInfoMessage("Initializing motor on port " + actorPort, this.lcd);
    switch ( actorType.getName() ) {
        case LARGE:
            this.lejosRegulatedMotors.put(actorPort, new EV3LargeRegulatedMotor(hardwarePort));
            break;
        case MEDIUM:
            this.lejosRegulatedMotors.put(actorPort, new EV3MediumRegulatedMotor(hardwarePort));
            break;
        case REGULATED:
            this.lejosRegulatedMotors.put(actorPort, new NXTRegulatedMotor(hardwarePort));
            break;
        default:
            throw new DbcException("Actor type " + actorType.getName() + " does not exists!");
    }
}
 
开发者ID:OpenRoberta,项目名称:robertalab-ev3lejos-v0,代码行数:18,代码来源:DeviceHandler.java

示例2: init

import lejos.hardware.motor.EV3MediumRegulatedMotor; //导入依赖的package包/类
public void init(boolean isClockwiseMove) {
	this.robotRunning = true;
	
	//Init Motor
	motorA = new EV3MediumRegulatedMotor(MotorPort.A);
	motorB = new EV3LargeRegulatedMotor(MotorPort.B);
	motorC = new EV3LargeRegulatedMotor(MotorPort.C);
	
	// init sensors
	this.colorSensor = new EV3ColorSensor(SensorPort.S3);
	//For reading color only
	try {
		this.colorSensorRGB = new EV3ColorSensor(SensorPort.S2);
	} catch(Exception e) {
		this.colorSensorRGB = null;
	}
	new Thread(new ColorIdentifyTask()).start();
	new Thread(new LightIdentifyTask()).start();
}
 
开发者ID:eSDK,项目名称:esdk_ide_ev3,代码行数:20,代码来源:HDCIDERobot.java

示例3: main

import lejos.hardware.motor.EV3MediumRegulatedMotor; //导入依赖的package包/类
public static void main(String[] args) {
	log.info("Initializing...");
	LCD.clear();
	disableOtherLogLayers();
	LCD.clear();
	Button.setKeyClickVolume(1);
	SystemTime.initSysTime();
	ClockProperties clockProperties = ClockProperties.getInstance();
	AnalogClock clock = new AnalogClock(clockProperties, new TickPeriod(5,
			TimeUnit.SECONDS), new Time(0, 20),
			MirrorMotor
					.invertMotor(new EV3MediumRegulatedMotor(MotorPort.A)),
			MirrorMotor
					.invertMotor(new EV3LargeRegulatedMotor(MotorPort.B)));
	MainWithMenu mainWithMenu = new MainWithMenu(clock);
	log.info("Ready");
	Sound.beep();
	mainWithMenu.start();
}
 
开发者ID:rafalmag,项目名称:EV3-projects,代码行数:20,代码来源:MainWithMenu.java

示例4: handleMotorMessage

import lejos.hardware.motor.EV3MediumRegulatedMotor; //导入依赖的package包/类
public void handleMotorMessage(Object msg) {
	if(msg instanceof RegulatedMotorMessages.RotateMessage){
		((EV3MediumRegulatedMotor) motor).rotate(((RegulatedMotorMessages.RotateMessage)msg).getAngle());
		return;
	}
	
	if(msg instanceof RegulatedMotorMessages.RotateToMessage){
		((EV3MediumRegulatedMotor) motor).rotateTo(((RegulatedMotorMessages.RotateToMessage)msg).getAngle());
		return;			
	}
	
	if (msg instanceof RegulatedMotorMessages.ForwardMsg) {
		
		motor.forward();
		return;
	}
	if (msg instanceof RegulatedMotorMessages.BackwardMsg) {
		motor.backward();
		return;
	}
	if (msg instanceof RegulatedMotorMessages.StopMsg) {
		motor.stop();
		return;
	}
	if (msg instanceof RegulatedMotorMessages.SetSpeedMsg) {
		((EV3MediumRegulatedMotor) motor).setSpeed(((RegulatedMotorMessages.SetSpeedMsg) msg).getSpeed());
		return;
	}
	// Drop packet otherwise
}
 
开发者ID:Echtzeitsysteme,项目名称:mindroid,代码行数:31,代码来源:MediumRegulatedMotor.java

示例5: handleMotorMessage

import lejos.hardware.motor.EV3MediumRegulatedMotor; //导入依赖的package包/类
@Override
public void handleMotorMessage(Object msg) {
    if(msg instanceof RegulatedMotorMessages.RotateMessage){
        ((EV3MediumRegulatedMotor) motor).rotate(((RegulatedMotorMessages.RotateMessage)msg).getAngle());
        return;
    }

    if(msg instanceof RegulatedMotorMessages.RotateToMessage){
        ((EV3MediumRegulatedMotor) motor).rotateTo(((RegulatedMotorMessages.RotateToMessage)msg).getAngle());
        return;
    }

    if (msg instanceof RegulatedMotorMessages.ForwardMsg) {
        motor.forward();
        return;
    }
    if (msg instanceof RegulatedMotorMessages.BackwardMsg) {
        motor.backward();
        return;
    }
    if (msg instanceof RegulatedMotorMessages.StopMsg) {
        motor.stop();
        return;
    }
    if (msg instanceof RegulatedMotorMessages.SetSpeedMsg) {
        ((EV3MediumRegulatedMotor) motor).setSpeed(((RegulatedMotorMessages.SetSpeedMsg) msg).getSpeed());
        return;
    }
}
 
开发者ID:Echtzeitsysteme,项目名称:mindroid,代码行数:30,代码来源:LargeRegulatedMotor.java

示例6: main

import lejos.hardware.motor.EV3MediumRegulatedMotor; //导入依赖的package包/类
public static void main(String[] args) {
    LCD.drawString("Hello world", 2, 3);
    Button.waitForAnyPress();
    EV3MediumRegulatedMotor ev3MediumRegulatedMotor = new EV3MediumRegulatedMotor(MotorPort.C);
    resetSmallEngine(ev3MediumRegulatedMotor);
    grab(ev3MediumRegulatedMotor);
    LCD.drawString("Position: " + ev3MediumRegulatedMotor.getPosition(), 2, 3);
    resetSmallEngine(ev3MediumRegulatedMotor);

    Button.waitForAnyPress();
}
 
开发者ID:jweijers,项目名称:EV3-robots,代码行数:12,代码来源:Hello.java

示例7: Canon

import lejos.hardware.motor.EV3MediumRegulatedMotor; //导入依赖的package包/类
public Canon(Port canonEnginePort, Port rotationEnginePort) {
    canonEngine = new EV3MediumRegulatedMotor(canonEnginePort);
    rotationEngine = new EV3LargeRegulatedMotor(rotationEnginePort);
    resetEngine(canonEngine);
    resetEngine(rotationEngine);

}
 
开发者ID:jweijers,项目名称:EV3-robots,代码行数:8,代码来源:Canon.java

示例8: mediumMotor

import lejos.hardware.motor.EV3MediumRegulatedMotor; //导入依赖的package包/类
public static synchronized Motor mediumMotor(Port port) {
    Motor motor = mediumMotor.get(port);
    if (motor == null) {
        motor = new Motor(new EV3MediumRegulatedMotor(port.getPort()));
        mediumMotor.put(port, motor);
    }
    return motor;
}
 
开发者ID:bdeneuter,项目名称:rx-mindstorms,代码行数:9,代码来源:Motors.java

示例9: instantiateMotorCannon

import lejos.hardware.motor.EV3MediumRegulatedMotor; //导入依赖的package包/类
/**
 * Instantiates the cannon-motor, optionally skips calibration
 * @param skipMotorCannonCalibration
 * @return
 */
private EV3MediumRegulatedMotor instantiateMotorCannon(
    boolean skipMotorCannonCalibration) {
  if (!skipMotorCannonCalibration) {
    calibrateMotorCannon();
  }
  EV3MediumRegulatedMotor motor = new EV3MediumRegulatedMotor(MotorPort.C);
  if (!skipMotorCannonCalibration) {
    motor.rotate(-360);
  }
  return motor;
}
 
开发者ID:magnusbae,项目名称:HelloBrick,代码行数:17,代码来源:EV3Helper.java

示例10: createMotor

import lejos.hardware.motor.EV3MediumRegulatedMotor; //导入依赖的package包/类
@Override
protected BaseMotor createMotor(Port motorPort){
	return new EV3MediumRegulatedMotor(motorPort);
}
 
开发者ID:Echtzeitsysteme,项目名称:mindroid,代码行数:5,代码来源:MediumRegulatedMotor.java

示例11: close

import lejos.hardware.motor.EV3MediumRegulatedMotor; //导入依赖的package包/类
@Override
public void close() {
	((EV3MediumRegulatedMotor)motor).close();;
}
 
开发者ID:Echtzeitsysteme,项目名称:mindroid,代码行数:5,代码来源:MediumRegulatedMotor.java

示例12: grab

import lejos.hardware.motor.EV3MediumRegulatedMotor; //导入依赖的package包/类
private static void grab(EV3MediumRegulatedMotor ev3MediumRegulatedMotor){
    ev3MediumRegulatedMotor.setStallThreshold(2, 10);
    ev3MediumRegulatedMotor.setSpeed(1000);
    ev3MediumRegulatedMotor.rotate(-500, false);
    ev3MediumRegulatedMotor.waitComplete();
}
 
开发者ID:jweijers,项目名称:EV3-robots,代码行数:7,代码来源:EventGrab.java

示例13: Canon

import lejos.hardware.motor.EV3MediumRegulatedMotor; //导入依赖的package包/类
public Canon(Port port){
    canonEngine = new EV3MediumRegulatedMotor(port);
    resetMotor();
    fire();

}
 
开发者ID:jweijers,项目名称:EV3-robots,代码行数:7,代码来源:CanonBot.java

示例14: resetSmallEngine

import lejos.hardware.motor.EV3MediumRegulatedMotor; //导入依赖的package包/类
private static void resetSmallEngine(EV3MediumRegulatedMotor ev3MediumRegulatedMotor){
    ev3MediumRegulatedMotor.setStallThreshold(2, 10);
    ev3MediumRegulatedMotor.setSpeed(500);
    ev3MediumRegulatedMotor.rotate(500, false);
    ev3MediumRegulatedMotor.waitComplete();
}
 
开发者ID:jweijers,项目名称:EV3-robots,代码行数:7,代码来源:Hello.java

示例15: SimpleEV3MediumMotor

import lejos.hardware.motor.EV3MediumRegulatedMotor; //导入依赖的package包/类
public SimpleEV3MediumMotor(Port port) {
  super(port, new EV3MediumRegulatedMotor(port));
}
 
开发者ID:jbenech,项目名称:gnikrap,代码行数:4,代码来源:SimpleEV3MediumMotor.java


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