Does anybody know how to program servos?

I'm on my school team for first tech challenge and we don't know how to program servos cuz we're new and we've tried programming them but they don't work does anybody know what's going on we have hitec servos (hs-475hb) we're trying to program them with RobotC for the first tech challenge

http://www.extremeflightrc.com/store/ima...

Comments

  • Dont know what robotC is but I would assume its some kind of ladder logic application. I have worked with RSlogix most of my life and the nice thing is RSlogix will tell you when youve made a mistake to a certain degree. Only thing I can tell you is if you have a known good drive board, your problem probably lies in improper syntax, sequence commands, or a malfunctioning sequencer.

  • If you're not using a specific servo controller, you'll have to program a duty cycle loop into your microcontroller.

    Assuming this is the case. I'm not familiar with RobotC, or your wiring. This should be easily adaptable to your situation.

    You'll need to create a function for setSignal - it will set the bit to change the signal where your servo is attached. You'll have to create a waitMS function that will wait the proper number of microseconds. Most microcontrollers will come with this documented somewhere.

    Angle = -80; // turn left to 80 degrees

    Angle = Angle + 90;

    // you may want to restrict angle to 0, 180 here.

    Vss = 1;

    Vdd = 0;

    for (;;) { // infinite loop to keep telling servo where to go

    setSignal(Vdd);

    waitMS(100); // wait

    setSignal(Vss);

    waitMS(600 + angle * 10); // give the proper signal to the servo

    }

Sign In or Register to comment.