Vexcode RotateFor Speed Help

This question should be pretty simple. I intend to move a motor for, lets say, 270 degrees using V5 and vexcode. I should be able to just say:

Motor.rotateFor(270, rotationUnits::deg);

But, what if I don’t want the motor to rotate 270 degrees at full speed? Is there a more effective way to do this?

You can set the velocity

Ah, I didn’t think that that would work. Thanks. Second question i just thought of, how would I use the internal motor encoders as a sensor to say something like “while this encoder is at less than x degrees then do this”? I saw this motor_claw.setRotation(0,rotationUnits::deg); when I was doing research but it doesn’t really show me how to read the variable.

Im currently looking at some example codes and saw this
06%20PM
This might help out some
You could say
if motor1 (rotation::units)>30 or something like that (maybe)

image
Hmm, for some reason it broke(?) another section of my code; these braces are now red and I’m not sure why or what it means.

EDIT: Oops, i forgot a brace to end auton.

It looks like it now works. I’ll test it next time I get my hands on the robot. Thanks!

LiftMotor.spin(directionType::rev);
while(LiftMotor.rotation(rotationUnits::deg)<100){
vex::task::sleep(5);
}
LiftMotor.stop();

Nice
20 Characters
Needs even more

Yup lol. One more thing, I’ve been having to use slots other than 1 on my brain because the program acts really weird on it. I think that there is some sort of preprogrammed setup in that slot with premapped ports and buttons (so you could use it without programming) that doesn’t align to what I’m using. I could probably figure it out given enough time, but it would help if you know how to fix it quickly.

By that do you mean on the controller the drive code that’s already preprogrammed and sits by the button to look at the other codes?

Well, I’ve loaded the code into slot 1, and the name appears on the controller, but when I run the program and press one joystick forward the left wheels spin inward and when i press the other stick forward the left wheels both spin one direction. There is some stuff in the brain that talks about buttons relating to certain motor ports so you can drive without coding and I think that is messing it, maybe disabling my code, because the other slots work fine. Does that answer the question?

Yes
If it works differently on the other slots then its probably an issue with your brain.
Also I figured I would put it here so you can easily reference it again. With the prebuilt examples go to file and go to open examples to find their movement/control/other stuff.

Hm, I might just force reset the brain or something. I’ve seen the examples from VEX, but ngl they kinda sucked. I was hoping for some real world examples of people posting they’re drive programs, but thats ok. Thanks.

I could show you ours if you are interested, but those show you different commands and stuff and how you use them. I don’t know of anywhere where you can just look at peoples code to see what can be done, but others might know.

If you already have a sensor filled autonomous I guess it could be useful, but I think I’ve learned most of the functions at this point. It just would’ve been useful back when I was trying to learn how to use a limit switch and stuff.

Definitely
I have built most of my knowledge on vex code off of just putting stuff in to see what it does/how it works, but looking on the forums definitely helps it along faster.

Yeah lol, I think I’ve doubled my knowledge in the last hour. My favorite method of learning code is copy and pasting sections of others code and editing it to fit my needs until I understand it well enough to make my own. That’s how I learned the little bit of arduino type stuff that I know.

That just goes to show the power of putting two heads together

Yeah, this forum is actually a lot more useful than I thought it would be; I generally prefer more chat text based things like Discord.

Actually, I do have one more question. What are you doing to select your autonomous? I was considering just using different program slots because I’m not proficient enough to make a screen based selector.

We currently have one functioning autonomous, but we are using a limit switch system to select it. I’ll post the code in a moment.