-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathLargeMotorDemo2.java
More file actions
38 lines (31 loc) · 1.11 KB
/
LargeMotorDemo2.java
File metadata and controls
38 lines (31 loc) · 1.11 KB
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
package examples.actuators;
import ev3dev.actuators.lego.motors.EV3LargeRegulatedMotor;
import lejos.hardware.port.MotorPort;
import lejos.utility.Delay;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class LargeMotorDemo2 {
public static void main(String[] args) throws InterruptedException {
System.out.println("Starting motors on A");
final EV3LargeRegulatedMotor mA = new EV3LargeRegulatedMotor(MotorPort.A);
mA.setSpeed(500);
mA.brake();
System.out.println("Forward");
mA.forward();
System.out.println("Large Motor is moving: " + mA.isMoving() + " at speed {}" + mA.getSpeed());
Delay.msDelay(2000);
mA.stop();
System.out.println("Stop");
System.out.println("Backward");
mA.backward();
System.out.println("Large Motor is moving: " + mA.isMoving() + " at speed {}" + mA.getSpeed());
Delay.msDelay(2000);
System.out.println("Stop");
mA.stop();
System.out.println("Forward");
mA.forward();
Delay.msDelay(2000);
mA.stop();
System.out.println("Stop");
}
}