SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import lejos.hardware.Button;
  2. import lejos.hardware.ev3.LocalEV3;
  3. import lejos.hardware.motor.EV3LargeRegulatedMotor;
  4.  
  5. /**
  6.  * Class for testing how far robot moves before robot is unable to perform double light sensor
  7.  * correction. For double light sensor correction test.
  8.  *
  9.  * @author Raymond Yang
  10.  * @version 1.0
  11.  * @date 2019/03/17
  12.  */
  13. public class DLScorr {
  14.  
  15.   // class variables
  16.  
  17.   /**
  18.    * The instance of the left wheel large EV3 motor. The left motor is connected to port A on the
  19.    * EV3 brick.
  20.    */
  21.   public static final EV3LargeRegulatedMotor LEFT_MOTOR =
  22.       new EV3LargeRegulatedMotor(LocalEV3.get().getPort("A"));
  23.  
  24.   /**
  25.    * The instance of the right wheel large EV3 motor. The right motor is connected to port D on the
  26.    * EV3 brick.
  27.    */
  28.   public static final EV3LargeRegulatedMotor RIGHT_MOTOR =
  29.       new EV3LargeRegulatedMotor(LocalEV3.get().getPort("D"));
  30.  
  31.   // main method
  32.  
  33.   public static void main(String args[]) throws Exception {
  34.  
  35.     // Wait for go
  36.     Button.waitForAnyPress();
  37.  
  38.     // wait 3s before starting
  39.     Thread.sleep(3000);
  40.  
  41.     // set speed
  42.     LEFT_MOTOR.setSpeed(300);
  43.     RIGHT_MOTOR.setSpeed(300);
  44.  
  45.     // go forward
  46.     LEFT_MOTOR.forward();
  47.     RIGHT_MOTOR.forward();
  48.  
  49.     // Wait for exit signal
  50.     Button.waitForAnyPress();
  51.     System.exit(0);
  52.   }
  53. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top