Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import lejos.hardware.Button;
- import lejos.hardware.ev3.LocalEV3;
- import lejos.hardware.motor.EV3LargeRegulatedMotor;
- /**
- * Class for testing how far robot moves before robot is unable to perform double light sensor
- * correction. For double light sensor correction test.
- *
- * @author Raymond Yang
- * @version 1.0
- * @date 2019/03/17
- */
- public class DLScorr {
- // class variables
- /**
- * The instance of the left wheel large EV3 motor. The left motor is connected to port A on the
- * EV3 brick.
- */
- public static final EV3LargeRegulatedMotor LEFT_MOTOR =
- new EV3LargeRegulatedMotor(LocalEV3.get().getPort("A"));
- /**
- * The instance of the right wheel large EV3 motor. The right motor is connected to port D on the
- * EV3 brick.
- */
- public static final EV3LargeRegulatedMotor RIGHT_MOTOR =
- new EV3LargeRegulatedMotor(LocalEV3.get().getPort("D"));
- // main method
- public static void main(String args[]) throws Exception {
- // Wait for go
- Button.waitForAnyPress();
- // wait 3s before starting
- Thread.sleep(3000);
- // set speed
- LEFT_MOTOR.setSpeed(300);
- RIGHT_MOTOR.setSpeed(300);
- // go forward
- LEFT_MOTOR.forward();
- RIGHT_MOTOR.forward();
- // Wait for exit signal
- Button.waitForAnyPress();
- System.exit(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement