Toggle Reverse code wont work help me, Needed for a non tank drive control type. VEX BLOCKS

Hello, new here.

I am trying to write a block code that allows the drivetrain to reverse in one button click. I wrote a toggle code that works, but the Reversing doesnt work.

I wrote it so that

whenever it toggles, it sets a variable to 1 then 0,

I added a while code so it runs the “drive forward” or “drive reverse” if the variable is one or zero. So whenever you click the controller button A, It reverses controller commands so when you do the controller up, it goes reverse and the other way around. feel free to ask anything you didn’t understand.

I am a new user so I couldn’t upload the blocks file. I am instead pasting a anonfile link here.

If you are using a drivetrain, this won’t work, because you have to switch which side is the left and right. You can do this by coding the individual wheels, so they look at the different stick if it is 1 or 0.

1 Like

hey @sankeydd, i tried your solution but it did not work. Our problem still remains. Can you elaborate and send a vblocks file if you can. We are kinda newbies and trying to figure out the basics.

A one button switcher of mine. Uses a state machine

Here’s a basic example. I just threw it together, and haven’t tested it, but there’s not much to it.

Depending on the state of switchDrive, it will switch the controller sticks AND their direction. That’s the key.

VEXCode IQ actually has features missing in Scratch. If you make a Boolean variable, that will streamline the switching process. In this code, the E Up button will switch the bot from front to back. You could add an if statement under the E Up event to turn on a touch led to indicate which end of the bot is the front… for the moment.


Hello @sankeydd after some further coding and tinkering, I guess there is no way to implement the similar method for a non tank drive controlling or is there another way to make this in a;

left stick - forward reverse
right stick - left right

kind of way?


But WHY???!!!

But some combination should work. Something like this?


What have you tried? Instead of just saying:

Let us know what you actually did.

And again, why? :slight_smile:


I tried what you did and changed the code for it to be left stick controllable. I just changed the directions.

and the driver find it way more comfy to use double stick rather than tank drive

Some adding or subtracting combination will work, just keep plugging at it!


Yes, the code worked. Thank you for your support and help <3