Servo command confusion?!?!?!?!

OK first off I’ve asked many people what to do, all their advice should work in theory. But never work in reality. I’m currently trying to program my robo-one style robot to walk (very tricky). I need to move more than one servo at a time, I’m using a BASIC atom from lynxmotion. To move one servo i tried using “SERVO (#of pin servo is on), (how much i want it to move)” or “PULSOUT (#of pin servo is on), (how much i want it to move)”. The thing is if i put 2 or more of these right ofter each other
(ie. SERVO 1, 800
SERVO 2, 800
SERVO 3, 800)
It will move servo 1, then servo 2, then servo 3 or in the order that the statements are entered. Is there a way that i can move all 3 together? If you need more info to help just ask. :confused:

Try putting
SERVO 1, 800: SERVO 2, 800: SERVO 3, 800

or

PULSOUT 1, 800: PULSOUT 2, 800: PULSOUT 3, 800:

at least that’s the way it works with a Basic Stamp.

Nope didn’t work, the manual says i have to use MSERVO then the pin # of the first servo, and then some other stuff. But when i try to add anything after MSERVO it turns black and tells me that there are errors when i try to program the chip.

Hrrm, so using a colon : and putting the commands ont he same line doesn’t work huh? I thought it might because it does on a Parallax BS but other than that I don’t know since I’m not a programmer.

I hope someone else has the answer because it seems to be an interesting problem and I am curious too as to what the solution is.

I believe the atom does not have hardware pwm in the chip. The servo command is a software implemented pwm. The sevo command is going to take a good amount of time. If you have to control the Servo signal very fast then you’ll need hardware pwm. The FRC has several hardware pwm outputs. there are several other microcontrolers that have pwm hardware or you could use a seperate pwm chip to control the servos.

The basic atom comes equipped with 16 direct servo pots, and 4 aux ports. It can handle all of the servos. But I don’t know which command to use in order to move more than one. It’s not a hardware problem it’s a programming problem.

If the basic atom pins are conected to the servos, then the behavior you are getting is the way it works. If you are using a servo board that the basic atom comunicates with and the board has a hardware PWM IC then the you have to reference the servo board comands. With a seperate servo board you could get the control you want. With out the hardware details, can’t tell which is the case. As a work around you could try puting the 3 servo commands in a loop and make small position changes each time thru the loop till you get to the desired positions. You mention a mservo command . I didn’t see this in the atom manual. Could it be an add in from the servo board? If its the case then it sounds like you have to add a function or something to your program.

no no no, i think you miss understood me, the board that’s holding the BASIC atom 24 pro is the one with the servo pins. I’m not directly connecting the controller chip to the servos.

This is the board with the inputs BASIC atom control board

Ok, your not using a separate servo board. Then the servo command is generating software PWM signals. Think of the servo command as a little function that turns the pin on and off according to the parameters that you give it. It generates the PWM signal for a certain period of time. Then it stops and returns to the next line of code. The atom servo command has a parameter that tells the command to repeat it’s self up to 30 times. You only want 1 period so it should be 1. The behavior your getting is exactly as expected. A work around to give the appearance of simultaneous control would be to put the servo commands in a loop and make small incremental changes. Something like the following.

Dim I
for I = -1200 to 1200 step 100
servo 1,I,1
servo 2,I,1
servo 3,I,1
next

The range and step can be changed to suit your needs. Depending on the speed of the processor and interpreter this should give the appearance of the servos moving together. If it’s not fast enough or it’s jerky then you may have to use a servo board. Look at the SSC-32 servo board from the site you referenced

Looking back at my Basic Stamp code which uses PULSOUT, it is in a DO loop. Also, there is a PAUSE of 20 (I guess that’s milliseconds) in the loop.