Advertisement
HTML

1.5.4JacobHoward.c no repeat()

Mar 11th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 11.12 KB | None | 0 0
  1. #pragma config(Sensor, dgtl1,  limitSwitch,    sensorTouch)
  2. #pragma config(Motor,  port2,           leftMotor,     tmotorVex393_MC29, openLoop)
  3. #pragma config(Motor,  port4,            ,             tmotorVex393_MC29, openLoop)
  4. //*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
  5.  
  6.  
  7. /*
  8.   Project Title: 1.5.4
  9.   Team Members: Jacob H, Joshua R, Gabriel J
  10.   Date: 3-8-19
  11.   Section:
  12.  
  13.  
  14.   Task Description:oscilate gear in both directions a total of 20 times
  15.  
  16.  
  17.   Pseudocode:
  18.  
  19. */
  20.  
  21.  
  22. task main()
  23. {
  24. /*
  25.     startMotor(leftMotor, 63); // Start motor
  26.     wait(.5); // Wait .5 seconds before proceeding
  27.     startMotor(leftMotor, -63); // Start motor
  28.     wait(.5); // Wait .5 seconds before proceeding
  29.     startMotor(leftMotor, 63); // Start motor
  30.     wait(.5); // Wait .5 seconds before proceeding
  31.     startMotor(leftMotor, -63); // Start motor
  32.     wait(.5); // Wait .5 seconds before proceeding
  33.     startMotor(leftMotor, 63); // Start motor
  34.     wait(.5); // Wait .5 seconds before proceeding
  35.     startMotor(leftMotor, -63); // Start motor
  36.     wait(.5); // Wait .5 seconds before proceeding
  37.     startMotor(leftMotor, 63); // Start motor
  38.     wait(.5); // Wait .5 seconds before proceeding
  39.     startMotor(leftMotor, -63); // Start motor
  40.     wait(.5); // Wait .5 seconds before proceeding
  41.     startMotor(leftMotor, 63); // Start motor
  42.     wait(.5); // Wait .5 seconds before proceeding
  43.     startMotor(leftMotor, -63); // Start motor
  44.     wait(.5); // Wait .5 seconds before proceeding
  45.     startMotor(leftMotor, 63); // Start motor
  46.     wait(.5); // Wait .5 seconds before proceeding
  47.     startMotor(leftMotor, -63); // Start motor
  48.     wait(.5); // Wait .5 seconds before proceeding
  49.     startMotor(leftMotor, 63); // Start motor
  50.     wait(.5); // Wait .5 seconds before proceeding
  51.     startMotor(leftMotor, -63); // Start motor
  52.     wait(.5); // Wait .5 seconds before proceeding
  53.     startMotor(leftMotor, 63); // Start motor
  54.     wait(.5); // Wait .5 seconds before proceeding
  55.     startMotor(leftMotor, -63); // Start motor
  56.     wait(.5); // Wait .5 seconds before proceeding
  57.     startMotor(leftMotor, 63); // Start motor
  58.     wait(.5); // Wait .5 seconds before proceeding
  59.     startMotor(leftMotor, -63); // Start motor
  60.     wait(.5); // Wait .5 seconds before proceeding
  61.     startMotor(leftMotor, 63); // Start motor
  62.     wait(.5); // Wait .5 seconds before proceeding
  63.     startMotor(leftMotor, -63); // Start motor
  64.     wait(.5); // Wait .5 seconds before proceeding
  65.     startMotor(leftMotor, 63); // Start motor
  66.     wait(.5); // Wait .5 seconds before proceeding
  67.     startMotor(leftMotor, -63); // Start motor
  68.     wait(.5); // Wait .5 seconds before proceeding
  69.     startMotor(leftMotor, 63); // Start motor
  70.     wait(.5); // Wait .5 seconds before proceeding
  71.     startMotor(leftMotor, -63); // Start motor
  72.     wait(.5); // Wait .5 seconds before proceeding
  73.     startMotor(leftMotor, 63); // Start motor
  74.     wait(.5); // Wait .5 seconds before proceeding
  75.     startMotor(leftMotor, -63); // Start motor
  76.     wait(.5); // Wait .5 seconds before proceeding
  77.     startMotor(leftMotor, 63); // Start motor
  78.     wait(.5); // Wait .5 seconds before proceeding
  79.     startMotor(leftMotor, -63); // Start motor
  80.     wait(.5); // Wait .5 seconds before proceeding
  81.     startMotor(leftMotor, 63); // Start motor
  82.     wait(.5); // Wait .5 seconds before proceeding
  83.     startMotor(leftMotor, -63); // Start motor
  84.     wait(.5); // Wait .5 seconds before proceeding
  85.     startMotor(leftMotor, 63); // Start motor
  86.     wait(.5); // Wait .5 seconds before proceeding
  87.     startMotor(leftMotor, -63); // Start motor
  88.     wait(.5); // Wait .5 seconds before proceeding
  89.     startMotor(leftMotor, 63); // Start motor
  90.     wait(.5); // Wait .5 seconds before proceeding
  91.     startMotor(leftMotor, -63); // Start motor
  92.     wait(.5); // Wait .5 seconds before proceeding
  93.     startMotor(leftMotor, 63); // Start motor
  94.     wait(.5); // Wait .5 seconds before proceeding
  95.     startMotor(leftMotor, -63); // Start motor
  96.     wait(.5); // Wait .5 seconds before proceeding
  97.     startMotor(leftMotor, 63); // Start motor
  98.     wait(.5); // Wait .5 seconds before proceeding
  99.     startMotor(leftMotor, -63); // Start motor
  100.     wait(.5); // Wait .5 seconds before proceeding
  101.     startMotor(leftMotor, 63); // Start motor
  102.     wait(.5); // Wait .5 seconds before proceeding
  103.     startMotor(leftMotor, -63); // Start motor
  104.     wait(.5); // Wait .5 seconds before proceeding
  105.     stopMotor(leftMotor); // End program
  106. */
  107. // 4: This is a open loop system; the loop will continue until time stops it, no external input is required
  108. // 5: In relatively the same location, it doesn't have much reason to change logiaclly.
  109. /*
  110.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  111.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  112.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  113.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  114.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  115.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  116.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  117.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  118.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  119.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  120.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  121.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  122.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  123.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  124.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  125.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  126.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  127.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  128.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  129.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  130.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  131.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  132.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  133.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  134.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  135.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  136.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  137.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  138.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  139.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  140.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  141.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  142.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  143.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  144.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  145.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  146.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  147.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  148.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  149.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  150.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  151.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  152.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  153.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  154.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  155.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  156.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  157.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  158.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  159.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  160.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  161.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  162.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  163.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  164.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  165.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  166.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  167.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  168.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  169.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  170.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  171.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  172.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  173.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  174.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  175.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  176.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  177.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  178.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  179.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  180.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  181.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  182.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  183.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  184.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  185.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  186.     startMotor(leftMotor, -63); // Start motor in the counterclockwise direction
  187.     untilBump(limitSwitch); // Proceed to spin counterclockwise until switch is activated
  188.     startMotor(leftMotor, 63); // Start motor in the clockwise direction
  189.     wait(.5); // Proceed to spin in clockwise direction for .5 seconds
  190.     stopMotor(leftMotor); // End program
  191. */
  192. // 10: This is a closed loop system; external sensor input is required to continue and eventually end the program
  193. // 11: The gear assembly should, like the last program, end in the same location since it will be instructed to change direction at the same point every time
  194. // 12: If the program is meant to run constantly, it should not be instructed to stop by non-emergency external sensor input
  195.  
  196. /*
  197.      1: An example of an open loop system could be a wind turbine, since this would only be stopped by the event of no wind.
  198.      2: An example of a closed loop system may be a light switch, since the light will continue to operate until shut off manually.
  199. */
  200. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement