-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrobot2
47 lines (41 loc) · 994 Bytes
/
robot2
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
#pragma config(Motor, port2, rightMotor, tmotorServoContinuousRotation, openLoop)
#pragma config(Motor, port3, leftMotor, tmotorServoContinuousRotation, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
void forward(){//moves robot forward
motor[leftMotor] = -127;
motor[rightMotor] = -127;
}
void backward(){//moves robot backwards
motor[leftMotor] = 127;
motor[rightMotor] = 127;
}
void right(){//rotates the robot right
motor[leftMotor] = -127;
motor[rightMotor] = 127;
}
void left(){//rotates the robot left
motor[leftMotor] = 127;
motor[rightMotor] = -127;
}
void stopMotors(){
motor[leftMotor] = 0;
motor[rightMotor] = 0;
}
task main()
{
while(true){
while(vexRT[Btn7U] == 1){
forward();
}
while(vexRT[Btn7L] == 1){
left();
}
while(vexRT[Btn7R] == 1){
right();
}
while(vexRT[Btn7D] == 1){
backward();
}
stopMotors();
}
}