Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. Pilot.setLinearSpeed(3);
  2. boolean LSense = false;
  3. boolean RSense = false;
  4. this.Pilot.forward();
  5.  
  6. while(!LSense && !RSense) {
  7. LSense = LBlack();
  8. RSense = RBlack();
  9. }
  10.  
  11. this.Pilot.stop();
  12. Pilot.setLinearSpeed(FORWARD_SPEED);
  13.  
  14. if (LSense || RSense) {
  15. if (LSense) {
  16. gyroReset();
  17. double GyroReading = getGyroSample();
  18. while(GyroReading < 5 || GyroReading < -5) {
  19. while(!LSense) {
  20. this.tinyRotate(-1);
  21. GyroReading = getGyroSample();
  22. LSense = LBlack();
  23. };
  24. do {
  25. this.tinyRotate(-1);
  26. GyroReading = getGyroSample();
  27. RSense = RBlack();
  28. }while(!RSense);
  29. break;
  30. }
  31. }
  32. else if (RSense) {
  33. gyroReset();
  34. double GyroReading = getGyroSample();
  35. while(GyroReading < 5 || GyroReading < -5) {
  36. do {
  37. this.tinyRotate(1);
  38. GyroReading = getGyroSample();
  39. RSense = RBlack();
  40. }while(!RSense);
  41.  
  42. do {
  43. this.tinyRotate(1);
  44. GyroReading = getGyroSample();
  45. LSense = LBlack();
  46. }while(!LSense);
  47. break;
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement