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.
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.
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