Putting tank drive into code for code challenge

Im doing the pitching in challenge right now for school and my team has already coded tank drive into the controller for the skills challenge, but now that we’re starting on the code, whenever we try and turn the bot only one side of the bot turns, e.x. :turning right: only the left side drives forward. We need it so that the other sides turns as well, e.x.: turning right: left side drives forward and right side drives backward.
Is there any way to code this into the bot? I’ve tried using booleans and other things with the drivetrain, I’ve tried replacing the drivetrain with a motor group and I still couldn’t figure out how to do it. The best option for me right now is to add each motor as its own device and put in the code for each motor individually but is there any way to do this faster or more effectively?
We’re using a 2 motor drivetrain with vex IQ block code.

Welcome To the Vex Forum! Are you an IQ or VRC?

2 Likes

Im using second generation vex iq

You can set it up as a drivetrain. In the menu where you add devices, select drivetrain 2 motor and then set it up that way. For a full walkthrough, go to this website: https://kb.vex.com/hc/en-us/articles/4406843427220-Configuring-a-2-Motor-Drivetrain-in-VEXcode-IQ-2nd-gen

I tried it like that but like I said, it only turns using one side, which is much slower than with two sides. Im trying to figure out how to make it turn using both wheels.

1 Like

You could try swapping the driving mode (in the controller setup) to tank control (the one where each joystick is one side of the robot). However, that might not be your team’s driver’s preferred driving mode, in which case you would end up having to code it manually.

When coding it manually, you can use motor groups to help you. Set the motors on one side of the robot as one motor group and the motors on the other side of the robot as another motor group. That way, when you tell the first motor group, for example, to spin forward, both motors on the side that motor group corresponds to will spin forward.