-
Notifications
You must be signed in to change notification settings - Fork 4
/
RegulatedMotorRotateDemo.java
42 lines (33 loc) · 1.12 KB
/
RegulatedMotorRotateDemo.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package examples.actuators;
import ev3dev.actuators.Sound;
import ev3dev.actuators.lego.motors.EV3LargeRegulatedMotor;
import lejos.hardware.port.MotorPort;
import lejos.utility.Delay;
public class RegulatedMotorRotateDemo {
public static void main(String[] args) {
Sound sound = Sound.getInstance();
final int degreesToTurn = 90;
final EV3LargeRegulatedMotor mA = new EV3LargeRegulatedMotor(MotorPort.A);
mA.resetTachoCount();
mA.setSpeed(100);
mA.brake();
sound.beep();
System.out.println("" + mA.getTachoCount());
mA.rotate(degreesToTurn);
sound.beep();
Delay.msDelay(1000);
System.out.println("" + mA.getTachoCount());
mA.rotate(degreesToTurn);
sound.beep();
Delay.msDelay(1000);
System.out.println("" + mA.getTachoCount());
mA.rotate(degreesToTurn);
sound.beep();
Delay.msDelay(1000);
System.out.println("" + mA.getTachoCount());
mA.rotate(degreesToTurn);
sound.beep();
Delay.msDelay(1000);
System.out.println("" + mA.getTachoCount());
}
}