• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java EV3MediumRegulatedMotor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: TRAC3RsArm

import lejos.hardware.motor.EV3MediumRegulatedMotor; //导入依赖的package包/类
public TRAC3RsArm() {
	

	System.out.println("Setting up Touch Sensor 1...");
	touchSensor1 = new EV3TouchSensor(LocalEV3.get().getPort(touchSensorPortName1));

	System.out.println("Setting up Touch Sensor 2...");
	touchSensor2 = new EV3TouchSensor(LocalEV3.get().getPort(touchSensorPortName2));

	System.out.println("Setting up Motor 1...");
	motor1 = new EV3LargeRegulatedMotor(motorPort1);
	motor1.rotateTo(0);

	System.out.println("Setting up Motor 2...");
	motor2 = new EV3LargeRegulatedMotor(motorPort2);
	motor2.rotateTo(0);

	System.out.println("Setting up Motor 3...");
	motor3 = new EV3MediumRegulatedMotor(motorPort3);
	motor3.rotateTo(0);	

}
 
开发者ID:stahlfabrik,项目名称:TRAC3R,代码行数:23,代码来源:TRAC3RsArm.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java UniformDistr类代码示例发布时间:2022-05-22
下一篇:
Java BlockSignPost类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap