How can translate a button toggle in blocks to vex code pro competition template

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()) {
  else if (Controller1.ButtonL2.pressing()) {
  else {
1 Like

Thank you so much you don’t know how much this is going to help me when coding for my robot auton :slight_smile: