Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.82 KB | None | 0 0
  1. //arm
  2. if(gamepad1.right_bumper){
  3. currentLevel++;
  4. if(currentLevel >= 9){
  5. currentLevel = 9;
  6. lift.Arm(0, false);
  7. }
  8. else if(currentLevel <= 2){
  9. lift.runDistance(heightToPivot, 0.5);
  10. lift.waitForEncoder();
  11. scorer.pivot.setPosition(1);
  12. lift.Arm(-0.5,true);
  13. }
  14. else if(currentLevel == 3){
  15. lift.runDistance(heightToPivot, 0.5);
  16. lift.waitForEncoder();
  17. scorer.pivot.setPosition(1);
  18. lift.runDistance(-4, 0.5);
  19. lift.waitForEncoder();
  20. }
  21. else {
  22. lift.runDistance(heightToPivot + (currentLevel * 4), 0.5);
  23. lift.waitForEncoder();
  24. scorer.setPivot(1);//out
  25. }
  26. telemetry.addData("CurrentLevel: " + currentLevel, "hi");
  27. telemetry.update();
  28. }
  29. if(gamepad1.left_bumper) {
  30. currentLevel--;
  31. if (currentLevel < 0) {
  32. currentLevel = 0;
  33. } else if (currentLevel < 3) {
  34. lift.Arm(0, false);
  35. } else{
  36. lift.runDistance(-4, 0.5);
  37. lift.waitForEncoder();
  38. }
  39. telemetry.addData("CurrentLevel: " + currentLevel, "hi");
  40. telemetry.update();
  41. }
  42. if(gamepad1.dpad_down) {
  43. if (currentLevel > 3) {
  44. currentLevel = 0;
  45. scorer.setPivot(0.05); // in
  46. lift.Arm(-0.5, true);
  47. scorer.setGripper(1); //gripper open
  48. intake.setHitter(1); //hitter out
  49. } else if (gamepad1.dpad_down && currentLevel == 3) {
  50. currentLevel = 0;
  51. lift.runDistance(4, 0.5);
  52. lift.waitForEncoder();
  53. scorer.setPivot(0.05);
  54. lift.Arm(-0.5, true);
  55. scorer.setGripper(1); //gripper open
  56. intake.setHitter(1); //hitter out
  57. } else if (gamepad1.dpad_down && currentLevel <= 2) {
  58. lift.runDistance(heightToPivot, 0.5);
  59. lift.waitForEncoder();
  60. scorer.pivot.setPosition(0.05);
  61. lift.Arm(-0.5, true);
  62. scorer.setGripper(1); //gripper open
  63. intake.setHitter(1); //hitter out
  64. }
  65. telemetry.addData("CurrentLevel: " + currentLevel, "hi");
  66. telemetry.update();
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement