I need the motor to run while I press L1

I need the motor to run as I hold L1. Right now if I press L1 the motor runs until it hits something.

what is your code? also what language, and where are you codding it? (RMS, Vex Code, VCS)

While(1){
if(controller.ButtonL1.pressing()){
    Spin motor
}
Else{
    Don’t. (Stop motor)
}
}

if(Controller1.ButtonR1.pressing()) {
Hand.spin(vex::directionType::fwd,50, vex::velocityUnits::pct);
}

if(Controller1.ButtonR2.pressing()) {
  Hand.spin(vex::directionType::rev,50, vex::velocityUnits::pct);
}  

//End Hand Code

I’m using Vex Code, the language is Vex C++

I tried this and got 15 errors

He wrote pseudocode. You’re not supposed to copy it and paste it. You’re supposed to translate it into vexcode

2 Likes

We shouldn’t (and can’t if this is for competition) outright make the code for you, I was just showing the logic that you are looking for.

I understand, and I’m not asking that of you. can you just explain how pseudocode can be vex. What do I put in place for what

Well it looks like you.have the right commands to spin the motor, so just input that for ‘spin motor’ and use ‘hand.stop()’ to stop the hand motor.

The problem with your previous code was just that you never told it to stop

2 Likes

My apologies for asking fellow engineers for help on my SCHOOL PROJECT, i’ll just ask my teacher tomorrow. I realize it’s cheating to ask for help with homework.

I reverted this topic to it’s original wording, but I’m also locking as it appears the OP decided against asking for more help.

1 Like