-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintakeOuttakeRoller.cpp
More file actions
35 lines (31 loc) · 1.04 KB
/
intakeOuttakeRoller.cpp
File metadata and controls
35 lines (31 loc) · 1.04 KB
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
#include "main.h"
//set the intake and control as well as outtake
void setRollerIntake(int theRollerIntakePower) {
rollerIntake = theRollerIntakePower;
}
int rollerIntakePower = 0;
bool rollerIntakeOn = false;
//intake and roller functions
void setRollerIntakeMotor() {
if (controller.get_digital_new_press(pros::E_CONTROLLER_DIGITAL_L1))
rollerIntakeOn = !rollerIntakeOn;
if (rollerIntakeOn && !controller.get_digital(pros::E_CONTROLLER_DIGITAL_R2)) {
if (controller.get_digital(pros::E_CONTROLLER_DIGITAL_L2)) {
rollerIntakePower = -127;
}
else {
rollerIntakePower = 127;
}
}
else if (!rollerIntakeOn && !controller.get_digital(pros::E_CONTROLLER_DIGITAL_R2)) {
rollerIntakePower = 0;
}
if (!rollerIntakeOn) {
if (controller.get_digital(pros::E_CONTROLLER_DIGITAL_R2))
rollerIntakePower = 127;
else {
rollerIntakePower = 0;
}
}
setRollerIntake(rollerIntakePower);
}