|
|
![]() |
![]() |
|
|||||||
|
![]() |
Thread Tools | Rate Thread | Display Modes |
#1
![]() |
|||
|
|||
motor reverse direction
how do i make my motors reverse direction if i'm programming in java? any possible references anybody could suggest? thx!!!
![]() |
#2
![]() |
||||
|
||||
It all has to do with the pwm value you pass to the motor (try making the value negative)
|
#3
![]() |
||||
|
||||
Re: motor reverse direction
It depends on what you're trying to do. If you're controlling a motor like motor.set(0.5), then you would change that to motor.set(-0.5). If you're using the output forom a joystick you should change something like motor.set(stick.getX()) to motor.set(-stick.getX()). Where motor is the motor you are inverting, and stick is the joystick you use to control it.
If you are using inverting a drive motor, it is a little different. You must use the setInvertedMotor method of robot drive. You would add drive.setInvertedMotor(kFrontLeft, true) for each of the drive motors you wish to change and would replace drive with the name of your robot drive object. If you only plan on running the motor in one direction, you could just wire the motor to the speed controller in a different way. |
#4
![]() |
|||
|
|||
Re: motor reverse direction
If you're using the SetSpeed function, or whatever it's called now (it's been a few years), the values passed (-1 to 1) determines the speed, with 0 being stopped, 1 being full power one direction, and -1 being the opposite direction at full power. Try negating the value passed in to the controller to make the motor spin the other way.
|
#5
![]() |
||||
|
||||
Re: motor reverse direction
This belongs in the programming forum, not the motors forum.
It depends on how you're controlling the motor. The standard method takes a double between -1 and 1 to control the speed; -1 backwards, 0 stopped, 1 forwards. What programming language are you using? What methods/functions are you using? Details like these would make it easier for us to help you. Good luck. |
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|