I am trying to make my code into a C++ project but have a 6 motor drive so when trying to configure the drivetrain in the robot-config.cpp I had to enable expert robot configuration so I’ve been trying to make my intake motor (PORT7) move forward whenever I press the button L1 and reverse when I press L2 but stop when I release the button.
This is the blocks project i want to convert into C++
Your block code has a flaw. The code will stay in the first forever loop and won’t reach the second forever loop. Just put everything in one forever loop.
while (true) {
if (Controller1.ButtonL1.pressing()) {
INTAKE.spin(forward);
}
else if (Controller1.ButtonL2.pressing()) {
INTAKE.spin(reverse);
}
else {
INTAKE.stop();
}
}