Drivetrain coding issue

image

is that how the robot moves? or is that just the code to switch velocity?

Code to change velocity, I don’t have the text for the joystick telling the drivetrain to spin forwards or stuff like that.

do you uae the automatic code for it? like where you bind it to the controller?

Yes, I do. I am in middle school and haven’t taken the time to learn C++ for this yet.

ok, what is happening is that the automatic driver control code sets the velocity to the axis position on the controller, then you change it to only being 40%, so nonmatter where the controller is, the drive train will go 40%

1 Like

I’m in middle school too, but I do text coding. Maybe you should try Python first, or go to Robotify. they have great coding courses.

Ok, I programmed Lego robots in text, but I forgot how to.

ah. I did legos too, but I could never find any text coding.

Correct, this is what I want to happen. The issue is that is wont turn or go in reverse and we can’t figure out why.

I was a special program you had to download onto a micro sd and replace it with the one in the cortex

yeah, 40% is forward, and -40% is backwards

Ohhh, ok. How would I make it be able to turn and go backwards with that.

The other issue is that when this code was there, it would still only go forwards, even when the button wasn’t pressed.

what do you have the drive train bound to? example:
image

image

Also, there is a dark mode?

you can try something like this, it sets the velocity to the (axis position * 40)/ 127 (which is the max value), so that when the axis value is the max (127), the value is 40, and when it is at it’s minimum (-127), the value is -40.

1 Like

yes, i think it is only in Vex code pro though

1 Like

So I could use something like this then put it in and if statement so it would be

If Controller 1 A pressed
do that line of code

1 Like

yes, but you will need to keep it pressed, so it keeps updating, what you could do is make it so that it toggles the variable itself.

image
which makes a variable named max set to 100


than the variable max changes what the max value

and you could make the else an else if controller button b to make it toggleable rather than requiring to be held down

2 Likes