Let's Make Robots!

Problem to control servo with picaxe

Hi everybody, 

This is the first time i use a picaxe 28x1 and i already have a problem...

I try to move two servos and it don't work.... I've made some tests with  peterjacob (Thanks man for your help!) but it still don't work (if you can help me again  peterjacob ;))

 

Here is my source code

servo 2,75

servopos 2,75

pause 2000

servopos 2,150

pause 2000

servopos 2,225

pause 2000

 

servo 4,75

servopos 4,75

pause 2000

servopos 4,150

pause 2000

servopos 4,225

pause 2000

 

 

If i execute this, the first servo move and after that the second servo only goes on the start position and stop....

 

I've tried another code, this one:

servo 4,75

servopos 4,75

pause 2000

servopos 4,150

pause 2000

servopos 4,225

pause 2000

 

servo 2,75

servopos 2,75

pause 2000

servopos 2,150

pause 2000

servopos 2,225

pause 2000

 

In this case both servos are working except that when it switch to servo 4 to servo 2, the servo 4 goes back to 75....

 

I only use one power source, if someone can help me, this thing drive me crazy...

 

Best regards. 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Lol!

Drinking is the cause of...   ...and the solution to, all the world's problems...

 

  -Homer Jay Simpson

Drinking is everytime the problem ;)
So for you it's a firmware problem?!
For me it's a drinking problem.
Your comment is ambiguous....

Yes sorry for this code it's an old one! Peter told me the same thing so the real code is this one:

servo 2,75

pause 2000

servo 2,150

pause 2000

servop 2,225

pause 2000

 

servo 4,75

pause 2000

servo 4,150

pause 2000

servo 4,225

pause 2000 

 

Sorry for my mistake :$

 

 

I've check my firmware and it's a A.2 do you think it can be the problem?

From the postings in the link that mv posted, you should be good.

Sounds like a bug to me. check which firmware you have as shown on screen after the program uploads or by using the FIRMWARE button.

Picaxe 28X1 firmware A.4 has a bug, get a replacement.

About the code:

the servo command initializes the servo. It resets the timer and defines the pin as a servo output and sets the position you passed on to the command. The resetting of the timer can sometimes cause jitter on other servos, so its advised to initialize all servos at the start of the program. 

As the servo command also sets the position, there is no need to follow it with servopos unless you want a different position.  In your posted code, the servopos 2,75 and servopos 4, 75 are redundant because they follow immediately after a servo command with the same position setting.