Advertisement
ArtskydJ

7701H Code

Dec 12th, 2013
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.45 KB | None | 0 0
  1. #pragma config(Sensor, dgtl1,  redmiddle,      sensorDigitalIn)
  2. #pragma config(Sensor, dgtl2,  bluemiddle,     sensorDigitalIn)
  3. #pragma config(Sensor, dgtl3,  redhang,        sensorDigitalIn)
  4. #pragma config(Sensor, dgtl4,  bluehang,       sensorDigitalIn)
  5. #pragma config(Motor,  port1,           armMotor,      tmotorVex393_HBridge, openLoop)
  6. #pragma config(Motor,  port2,           leftfront,     tmotorVex393_MC29, openLoop)
  7. #pragma config(Motor,  port3,           leftmidfront,  tmotorVex393_MC29, openLoop)
  8. #pragma config(Motor,  port4,           leftmidback,   tmotorVex393_MC29, openLoop)
  9. #pragma config(Motor,  port5,           leftback,      tmotorVex393_MC29, openLoop)
  10. #pragma config(Motor,  port6,           rightfront,    tmotorVex393_MC29, openLoop, reversed)
  11. #pragma config(Motor,  port7,           rightmidfront, tmotorVex393_MC29, openLoop)
  12. #pragma config(Motor,  port8,           rightmidback,  tmotorVex393_MC29, openLoop)
  13. #pragma config(Motor,  port9,           rightback,     tmotorVex393_MC29, openLoop, reversed)
  14.  
  15. task autonomous()
  16. {
  17.     if (SensorBoolean[redmiddle]) // jumper port is plugged in
  18.     {   // Autonomous code below to run if in the Middle Zone, red alliance
  19.  
  20.         motor[armMotor] = 127;
  21.         wait1Msec(100);
  22.  
  23.         motor[leftfront] = 127;
  24.         motor[leftmidfront] = 127;
  25.         motor[leftmidback] = 127;
  26.         motor[leftback] =127;
  27.         motor[rightfront] =127;
  28.         motor[rightmidfront] = 127;
  29.         motor[rightmidback] = 127;
  30.         motor[rightback] = 127;
  31.     }
  32.     else if (SensorBoolean[bluemiddle])
  33.     {   // Autonomous code below to run if in the Middle Zone, blue alliance
  34.         motor[leftfront] = 127;
  35.         motor[leftmidfront] = 127;
  36.         motor[leftmidback] = 127;
  37.         motor[leftback] =127;
  38.         motor[rightfront] =127;
  39.         motor[rightmidfront] = 127;
  40.         motor[rightmidback] = 127;
  41.         motor[rightback] = 127;
  42.     }
  43.     else if (SensorBoolean[redhang])
  44.     {   // Autonomous code below to run if in the Hanging Zone, red alliance
  45.         motor[leftfront] = 127;
  46.         motor[leftmidfront] = 127;
  47.         motor[leftmidback] = 127;
  48.         motor[leftback] =127;
  49.         motor[rightfront] =127;
  50.         motor[rightmidfront] = 127;
  51.         motor[rightmidback] = 127;
  52.         motor[rightback] = 127;
  53.     }
  54.     else if (SensorBoolean[bluehang])
  55.     {   // Autonomous code below to run if in the Hanging Zone, blue alliance
  56.         motor[leftfront] = 127;
  57.         motor[leftmidfront] = 127;
  58.         motor[leftmidback] = 127;
  59.         motor[leftback] = 127;
  60.         motor[rightfront] = 127;
  61.         motor[rightmidfront] = 127;
  62.         motor[rightmidback] = 127;
  63.         motor[rightback] = 127;
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement