Arm(claw) not working


Our arm and claw aren’t working in driver control, and we have the unusual code here:
"if(Controller1.ButtonR1.pressing()) {
ArmMotor.spin(directionType::fwd, velocityUnits::pct):wink:

             else if(Controller1.ButtonR2.pressing())  {
                              ArmMotor.spin(directionType::rev, velocityUnits::pct)"

If you-if anybody could help, my team will be grateful. But for now-we have a frustrating bug in our code.
It’s going backward.


You haven’t actually placed any speeds in there. You’re telling them to spin at some undetermined percentage of the maximum speed.

(I’m assuming this is within a while loop to keep checking for button presses.)


The code is the bug code not the real one. The one above isn’t the real one it’s the bug it gives us.


Oh, also fix your curly brackets. The else if is inside the if, and everything beyond is inside both of them.


I’m confused. Debuggers don’t generally make code for you. The generally highlight what part of your code is problematic. I’m pretty sure no debugger just created that whole code from scratch for you.


?? We can’t check now the computer has no battery


The compiler flags those lines because they are the ones with problems. Those are highlighted excerpts from your real code that has problems. Put numbers in for your velocities. It’s telling you the spin methods do not exist as you tried to use them.


Take our words for it. We’re both telling you the same thing. You can use motor.spin one of two ways. You can have already set the velocity via motor.setVelocity, in which case you only put in the direction for motor.spin, so just one argument. Alternatively, you can set the direction and the speed with motor.spin, in which case it takes three arguments. Your motor.spin calls have two arguments, which don’t fit either of the options.

You may not be missing the brackets, since you may just have two excerpted out of a bunch of lines. In the future it would be good to actually show the surrounding code as well use using the Code tags so it gets formatted well.


I guess you want to use the function Motor.spin() with three parameters,which are dir,velocity,units.
So try this one:


*The position of 100 can be changed with any velocity you want
(since you are using pct ,it should be in -100,100])
BTW:the second Motor.spin you posted is missing a “;” behind it.


@ZoeChow @callen & JohnTYler
Ok, thanks!