1. 4 weeks ago

    bluspeed427

    Dec 17 A galaxy far, far, away... 902D
    Edited 4 weeks ago by bluspeed427

    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);)

    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.

    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.

  2. Deleted 4 weeks ago by bluspeed427
  3. callen

    Dec 17 Braintree, MA, USA

    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.)

  4. bluspeed427

    Dec 17 A galaxy far, far, away... 902D

    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.

  5. callen

    Dec 17 Braintree, MA, USA

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

  6. callen

    Dec 17 Braintree, MA, USA

    @bluspeed427 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.

    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.

  7. bluspeed427

    Dec 17 A galaxy far, far, away... 902D

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

  8. John TYler

    Dec 17 Answer WA

    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.

  9. callen

    Dec 17 Braintree, MA, USA

    @bluspeed427 ?? We can't check now the computer has no battery

    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.

  10. Edited 4 weeks ago by ZoeChow

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

    ArmMotor.spin(directionType::fwd,100,velocityUnits::pct);

    *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.

  11. last week

    bluspeed427

    Jan 14 A galaxy far, far, away... 902D
    Edited last week by bluspeed427

    @ZoeChow @callen & JohnTYler
    Ok, thanks!

 

or Sign Up to reply!