HTML

1.5.1JacobHoward.c

Mar 5th, 2019
307
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.71 KB | None | 0 0
  1. #pragma config(Sensor, in1,    lineFollower,   sensorLineFollower)
  2. #pragma config(Sensor, in2,    potentiometer,  sensorPotentiometer)
  3. #pragma config(Sensor, dgtl1,  limitSwitch,    sensorTouch)
  4. #pragma config(Sensor, dgtl2,  bumpSwitch,     sensorTouch)
  5. #pragma config(Sensor, dgtl3,  quad,           sensorQuadEncoder)
  6. #pragma config(Sensor, dgtl5,  sonar,          sensorSONAR_cm)
  7. #pragma config(Sensor, dgtl12, green,          sensorLEDtoVCC)
  8. #pragma config(Motor,  port1,           flashlight,    tmotorVexFlashlight, openLoop, reversed)
  9. #pragma config(Motor,  port2,           rightMotor,    tmotorVex393_MC29, openLoop)
  10. #pragma config(Motor,  port3,           leftMotor,     tmotorVex393_MC29, openLoop)
  11. #pragma config(Motor,  port9,           servoMotor,    tmotorServoStandard, openLoop)
  12. //*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
  13.  
  14. task main()
  15. {
  16. /*
  17. untilBump(bumpSwitch);
  18. startMotor(rightMotor, 67);
  19. wait(5);
  20. stopMotor(rightMotor);
  21. */
  22.  
  23. /*
  24. untilBump(bumpSwitch);
  25. startMotor(rightMotor, 50);
  26. startMotor(leftMotor, 50);
  27. wait(1);
  28. untilBump(bumpSwitch);
  29. startMotor(rightMotor, -50);
  30. startMotor(leftMotor, -50);
  31. wait(3.5);
  32. stopMotor(rightMotor);
  33. stopMotor(leftMotor);
  34. */
  35.  
  36. /*
  37. untilPotentiometerLessThan(2048, potentiometer);
  38. turnLEDOn(green);
  39. untilPotentiometerGreaterThan(2048, potentiometer);
  40. turnLEDOff(green);
  41. startMotor(leftMotor, 50);
  42. untilPotentiometerLessThan(2048, potentiometer);
  43. stopMotor(leftMotor);
  44. */
  45.  
  46. /*
  47. startMotor(leftMotor, 63);
  48. startMotor(rightMotor, 63);
  49. untilEncoderCounts(480, quad);
  50. startMotor(leftMotor, -63);
  51. startMotor(rightMotor, -63);
  52. untilEncoderCounts(1260, quad);
  53. stopMotor(leftMotor);
  54. stopMotor(rightMotor);
  55. */
  56.  
  57. /*
  58. setServo(servoMotor, 127);
  59. untilLight(1700, lineFollower);
  60. setServo(servoMotor, -127);
  61. */
  62.  
  63. /*
  64. untilSonarLessThan(20, sonar);
  65. startMotor(leftMotor, 63);
  66. startMotor(rightMotor, 63);
  67. untilSonarGreaterThan(25, sonar);
  68. stopMotor(leftMotor);
  69. stopMotor(rightMotor);
  70. */
  71.  
  72. /*
  73. 1. In the beginning, we needed to swap out our cortex due to a "bootloader" error it was encountering upon startup. For a little while,
  74. the program kept telling us that the firmware was out of date, but I was able to fix this by manually updating the robot firmware instead
  75. of using the automatic option. Also, we didn't have an ultrasonic sensor, so that last problem was purely guesswork on the code since it couldn't
  76. actually  be debugged.
  77.  
  78. 2. Bump and limit switches can both be used to engage or disengage a machine. Potentiometers could /potentially/ be used to measure how many degrees
  79. a robot arm has travelled from home. Encoders could also be used to measure how far a machine has travelled (by use of an auxiliary wheel).
  80. */
  81.  
  82. }
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment