Update 'main.c'

master
Cole Deck 6 years ago
parent 597cd06c90
commit d3031766aa

@ -82,16 +82,63 @@ void pre_auton() {
bStopTasksBetweenModes = true; bStopTasksBetweenModes = true;
} }
void driveTiles(int numberOfTiles) { void driveTiles(int numberOfTiles, boolean direction) {
while(numberOfTiles * TILE > nMotorEncoder[1]) [
// TODO while(direction && numberOfTiles * TILE > nMotorEncoder[1]) [
if(abs(nMotorEncoder[1]) - 10 > nMotorEncoder[2]) {
motor[driveLB] = 100;
motor[driveLF] = 100;
motor[driveRB] = 90;
motor[driveRF] = 90;
}
if(abs(nMotorEncoder[2]) - 10 > nMotorEncoder[1]) {
motor[driveLB] = 90;
motor[driveLF] = 90;
motor[driveRB] = 100;
motor[driveRF] = 100;
} else {
motor[driveLB] = 100;
motor[driveLF] = 100;
motor[driveRB] = 100;
motor[driveRF] = 100;
}
}
while(!direction && numberOfTiles * TILE > nMotorEncoder[1]) [
if(abs(nMotorEncoder[1]) - 10 > nMotorEncoder[2]) {
motor[driveLB] = -100;
motor[driveLF] = -100;
motor[driveRB] = -90;
motor[driveRF] = -90;
}
if(abs(nMotorEncoder[2]) - 10 > nMotorEncoder[1]) {
motor[driveLB] = -90;
motor[driveLF] = -90;
motor[driveRB] = -100;
motor[driveRF] = -100;
} else {
motor[driveLB] = -100;
motor[driveLF] = -100;
motor[driveRB] = -100;
motor[driveRF] = -100;
}
} }
} }
task autonomous() { task autonomous() {
shootBall(); shootBall();
driveTiles(2, true);
//driveTiles(1, false);
}
void turnRight(int turns) {
while(turns * 360 < nMotorEncoder[1]
}
void turnLeft(int turns) {
}
void clearEnc() {
nMotorEncoder[1] = 0;
nMotorEncoder[2] = 0;
} }
task usercontrol() { task usercontrol() {
while (true) { while (true) {
//Dual Driving //Dual Driving

Loading…
Cancel
Save