1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#pragma config(Sensor, in1, LightS, sensorReflection)
#pragma config(Motor, port3, LeftBack, tmotorVex393_MC29, openLoop, driveLeft)
#pragma config(Motor, port4, RightFront, tmotorVex393_MC29, openLoop, driveRight)
#pragma config(Motor, port5, RightBack, tmotorVex393_MC29, openLoop, driveRight)
#pragma config(Motor, port6, OutsideArm, tmotorVex393_MC29, openLoop, driveRight)
#pragma config(Motor, port7, InsideArm, tmotorVex393_MC29, openLoop, driveLeft)
#pragma config(Motor, port8, LeftFront, tmotorVex393_MC29, openLoop, driveLeft)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main()
{
// Wait for Btn8D down
while (vexRT[Btn8D] == 0) {
}
// go back
motor[LeftFront] = -127;
motor[LeftBack] = -127;
motor[RightFront] = -127;
motor[RightBack] = -127;
wait1Msec(1200);
// stop
motor[LeftFront] = 0;
motor[LeftBack] = 0;
motor[RightFront] = 0;
motor[RightBack] = 0;
wait1Msec(500);
// go forward
motor[LeftFront] = 127;
motor[LeftBack] = 127;
motor[RightFront] = 127;
motor[RightBack] = 127;
wait1Msec(1200);
// stop
motor[LeftFront] = 0;
motor[LeftBack] = 0;
motor[RightFront] = 0;
motor[RightBack] = 0;
// do this forever more...
while (1 == 1) {
//Driving Motor Control
motor[port8] = vexRT[Ch3]; // why port8 and not LeftFront
motor[LeftBack] = vexRT[Ch3]; // what is vexRT[Ch3] ?
motor[RightFront] = vexRT[Ch2]; // is it one of the buttons?
motor[RightBack] = vexRT[Ch2];
//Arm Control
if (vexRT[Btn6U] == 1) {
motor[OutsideArm] = 127;
motor[InsideArm] = 127;
} else if (vexRT[Btn6D] == 1) {
motor[OutsideArm] = -40;
motor[InsideArm] = -40;
} else {
// are Btn6U and Btn6D the same physical button?
// if so, you're never executing this code!
motor[OutsideArm] = 0;
motor[InsideArm] = 0;
}
}
}
| |