Advertisement
Guest User

stopcar

a guest
Jan 28th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. import lejos.hardware.Button;
  2. import lejos.hardware.lcd.LCD;
  3. import lejos.hardware.motor.BaseRegulatedMotor;
  4. import lejos.hardware.motor.EV3LargeRegulatedMotor;
  5. import lejos.hardware.port.MotorPort;
  6. import lejos.utility.Delay;
  7.  
  8. public class StopCar {
  9.  
  10. public static void main(String[] args) {
  11. // TODO Auto-generated method stub
  12. Button . ENTER . waitForPressAndRelease ();
  13. BaseRegulatedMotor mLeft = new EV3LargeRegulatedMotor ( MotorPort . A );
  14. BaseRegulatedMotor mRight = new EV3LargeRegulatedMotor ( MotorPort . B );
  15. mLeft . setSpeed (720); // 2 Revolutions Per Second ( RPS )
  16. mRight . setSpeed (720);
  17. mLeft . forward ();
  18. mRight . forward ();
  19. Button . ENTER . waitForPressAndRelease ();
  20. mLeft . stop ();
  21. mRight . stop ();
  22. LCD . drawInt ( mLeft . getTachoCount () ,0 ,0);
  23. mLeft . close ();
  24. mRight . close ();
  25. Button . ENTER . waitForPressAndRelease ();
  26.  
  27. }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement