Log in

View Full Version : Java Servo Issue


Brian Selle
12-06-2012, 23:20
This all seems so simple... but we've been unsuccessful getting a servo working in our Java code. We are using a Hitec HS-475HB servo attached to a PWM port on the digital sidecar. We've tripled checked PWM port number and it is correct. I don't have the code with me but here is basically what we are doing:

1) Created a new subsystem class for the servo

2) In the constructor we instance a Servo class using the PWM port as the argument:

m_myServo = new Servo(2);

3) In a method called MoveMyServo() we call

m_myServo.setAngle(20); // actually we increment the previous value by 20

4) We've tried called setPostion() and set() with no joy but after looking through Servo class all these methods eventually call setPosition() with a value from 0-1.

5) Put print statements and stepped through the debugger to verify that the constructor is being called (without errors) and the MoveMyServo() method gets called each time the button is pressed.

In the Servo class it mentions it is set up for a Hitec HS-322HD... does that matter? Are we missing something here?

wireties
12-06-2012, 23:51
Is the power jumper (next to the PWM connector) installed?

WizenedEE
13-06-2012, 01:57
The power jumper seems like it's the most likely error, but you could also try the servo on another pin. One of ours had died (we left a PWM cable hanging off of it and it shorted)

Brian Selle
13-06-2012, 08:17
Is the power jumper (next to the PWM connector) installed?

That must be it! Will try it out tonight.

Brian Selle
13-06-2012, 23:09
Jumper solved the issue. Thanks guys!