Getting my servo to move

This is where you talk about the NXJ hardware related topics such as the brick, sensors, LEGO pieces, etc.

Moderators: 99jonathan, roger, imaqine

Getting my servo to move

Postby javareds » Tue Dec 03, 2013 7:13 pm

I have tried the folloowing code and my motor will run but my servo does not move any help would be great.
Code: Select all
package HiTechMotor;
import lejos.nxt.SensorPort;
import lejos.nxt.addon.tetrix.TetrixControllerFactory;
import lejos.nxt.addon.tetrix.TetrixEncoderMotor;
import lejos.nxt.addon.tetrix.TetrixMotorController;
import lejos.nxt.addon.tetrix.TetrixServo;
import lejos.nxt.addon.tetrix.TetrixServoController;


public class HiTechMotor {
    public static void main(String[] args) throws Exception{
          TetrixControllerFactory cf = new TetrixControllerFactory(SensorPort.S1);
   /* TetrixMotorController mc = cf.newMotorController();
    TetrixEncoderMotor mot1 = mc.getEncoderMotor(TetrixMotorController.MOTOR_1);
    mot1.setPower(50);
   
    mot1.forward();
    Thread.sleep(4000);
    mot1.stop();
    mot1.backward();
    Thread.sleep(4000);
    mot1.stop();
    Thread.sleep(400);*/
    TetrixServoController sc = cf.newServoController();
    TetrixServo ser1 = sc.getServo(1);
    ser1.setRange(750, 2250, 200);
   
    ser1.setAngle(90);

    Thread.sleep(1000);
    ser1.setAngle(200);
   
    Thread.sleep(1000);
    ser1.setAngle(10);
    Thread.sleep(1000);
 
    }

}
javareds
New User
 
Posts: 3
Joined: Mon Mar 18, 2013 1:15 pm

Re: Getting my servo to move

Postby kirkpthompson » Sun Dec 08, 2013 1:34 am

Have you tried testing the servo and controller using the Lego software? Are you sure the servo and server controller are functional?

Best,
-K
Leg Godt!
User avatar
kirkpthompson
leJOS Team Member
 
Posts: 304
Joined: Wed Dec 05, 2007 1:27 am
Location: New Mexico, USA


Return to NXJ Hardware

Who is online

Users browsing this forum: No registered users and 0 guests

more stuff