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


Java RegulatedMotor.stop方法代码示例

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


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

示例1: main

import lejos.robotics.RegulatedMotor; //导入方法依赖的package包/类
public static void main(String[] args) {
		EV3 ev3 = (EV3) BrickFinder.getLocal();
		TextLCD lcd = ev3.getTextLCD();
		Keys keys = ev3.getKeys();
		
		EV3TouchSensor touchSensor = new EV3TouchSensor(SensorPort.S1);
		SensorMode touch = touchSensor.getTouchMode();
		float[] sample = new float[touch.sampleSize()];
		
		RegulatedMotor m = new EV3LargeRegulatedMotor(MotorPort.A);
		m.resetTachoCount();
		
		m.rotateTo(320, true);
		
//		int angle = m.getTachoCount(); // should be -360
//		lcd.drawInt(angle, 0, 0);
//		keys.waitForAnyPress();
		
//		m.rotateTo(-100, true);
//		do{
//			touch.fetchSample(sample, 0);
//		} while (sample[0] == 0);
		
		while (m.isMoving())
			Thread.yield();
		m.stop();	
		
		int angle = m.getTachoCount(); // should be < -100
		lcd.drawInt(angle, 0, 1);
//		keys.waitForAnyPress();
	}
 
开发者ID:iproduct,项目名称:course-social-robotics,代码行数:32,代码来源:MotorDemo03.java

示例2: main

import lejos.robotics.RegulatedMotor; //导入方法依赖的package包/类
public static void main(String[] args) {
	EV3 ev3 = (EV3) BrickFinder.getLocal();
	TextLCD lcd = ev3.getTextLCD();
	Keys keys = ev3.getKeys();

	// lcd.drawString("Hello Trayan", 4, 2);
	// lcd.drawString("from leJOS", 4, 3);

	// Move forward
	RegulatedMotor mB = new EV3LargeRegulatedMotor(MotorPort.B);
	RegulatedMotor mC = new EV3LargeRegulatedMotor(MotorPort.C);
	mB.synchronizeWith(new RegulatedMotor[] { mC });

	mB.startSynchronization();
	mB.forward();
	mC.forward();
	mB.endSynchronization();

	Delay.msDelay(3000);
	mB.startSynchronization();
	mB.stop();
	mC.stop();
	mB.endSynchronization();

	// keys.waitForAnyPress(5000);
}
 
开发者ID:iproduct,项目名称:course-social-robotics,代码行数:27,代码来源:MoveRobot.java

示例3: action

import lejos.robotics.RegulatedMotor; //导入方法依赖的package包/类
@Override
public void action() {
    suppressed = false;

    RegulatedMotor leftMotor = grabBot.getLeft();
    RegulatedMotor rightMotor = grabBot.getRight();
    leftMotor.synchronizeWith(new RegulatedMotor[]{rightMotor});
    leftMotor.forward();
    rightMotor.forward();
    while( !suppressed ) {
        Thread.yield();
    }
    leftMotor.stop(); // clean up
    rightMotor.stop();
}
 
开发者ID:jweijers,项目名称:EV3-robots,代码行数:16,代码来源:ForwardBehavior.java

示例4: action

import lejos.robotics.RegulatedMotor; //导入方法依赖的package包/类
@Override
public void action() {
    suppressed = false;
    RegulatedMotor leftMotor = grabBot.getLeft();
    RegulatedMotor rightMotor = grabBot.getRight();

    leftMotor.rotate(-180, true);
    rightMotor.rotate(-360, true);

    while( (leftMotor.isMoving() || rightMotor.isMoving()) && !suppressed )
        Thread.yield();

    leftMotor.stop(); // clean up
    rightMotor.stop();
}
 
开发者ID:jweijers,项目名称:EV3-robots,代码行数:16,代码来源:ObstacleBehavior.java

示例5: stopMotor

import lejos.robotics.RegulatedMotor; //导入方法依赖的package包/类
private void stopMotor(RegulatedMotor regulatedMotor) {
    regulatedMotor.setSpeed(0);
    regulatedMotor.stop(true);
}
 
开发者ID:dialogflow,项目名称:dialogflow-java-client,代码行数:5,代码来源:MainActivity.java

示例6: main

import lejos.robotics.RegulatedMotor; //导入方法依赖的package包/类
public static void main(String[] args) {
	EV3 ev3 = (EV3) BrickFinder.getLocal();
	TextLCD lcd = ev3.getTextLCD();
	Keys keys = ev3.getKeys();
	
	EV3TouchSensor touchSensor = new EV3TouchSensor(SensorPort.S1);
	SensorMode touch = touchSensor.getTouchMode();
	float[] sample = new float[touch.sampleSize()];
	
	RegulatedMotor mA = new EV3LargeRegulatedMotor(MotorPort.A);
	RegulatedMotor mB = new EV3LargeRegulatedMotor(MotorPort.B);
	RegulatedMotor mC = new EV3LargeRegulatedMotor(MotorPort.C);
	mA.resetTachoCount();
	mB.resetTachoCount();
	mC.resetTachoCount();
	
	mA.rotateTo(760);
	int angle = mA.getTachoCount(); // should be -360
	lcd.drawInt(angle, 0, 0);
	keys.waitForAnyPress();
	
	mB.setSpeed(720);// 2 RPM
	mC.setSpeed(720);
	mB.forward();
	mC.forward();
	Delay.msDelay(1000);
	mB.stop();
	mC.stop();
	mB.rotateTo(360);
	mB.rotate(-720, true);
	while (mB.isMoving())
		Thread.yield();
	angle = mB.getTachoCount(); 
	lcd.drawInt(angle, 0, 1);
	
	mA.rotateTo(-100, true);
	do{
		touch.fetchSample(sample, 0);
	} while (mA.isMoving() && sample[0] == 0);
	mA.stop();	
	
	angle = mA.getTachoCount(); // should be -360
	lcd.drawInt(angle, 0, 2);
	keys.waitForAnyPress();
}
 
开发者ID:iproduct,项目名称:course-social-robotics,代码行数:46,代码来源:MotorDemo06.java

示例7: stop

import lejos.robotics.RegulatedMotor; //导入方法依赖的package包/类
private static void stop(RegulatedMotor motor)
{
    motor.stop();
}
 
开发者ID:abid-mujtaba,项目名称:ev3-Plotter,代码行数:5,代码来源:Plotter.java


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