I have some code and would like to times the motor power of back drive and right drive by 2 so iI tried
if(vexRT(Ch1) > 20 || (vexRT(Ch1) < -20))
motor[backdrive] = vexRT(Ch1);
motor[fordrive] = vexRT(Ch1);
motor[leftdrive] = vexRT(Ch1);
motor[rightdrive] = vexRT(Ch1);
Well it’s important to keep in mind that the motors’ max speed is 127 - setting them to anything higher than that won’t make them go any faster. However, you could accomplish what you want to do like this:
motor[rightdrive] = vexRT[Ch1] * 2;
Just put this code (changing the motor and channel, of course) wherever you want, and it should work.
If you have space somewhere else on your bot you can also use gears, chains, and some other pieces to your advantage to have more than one motor powering a single shaft. It’s a bit out of the way, but if it is really that important it is well worth it.
Technically this will work as written. However, in reality you’ll just reduce the precision of your movements, since with this code, moving the joystick to half as far as it can go sends full motor power. To make your robot faster, you’d need to add some sort of gearing to your drivetrain like @Deicer explained.