Let's Make Robots!

Picaxe 28x1 Timing My Servos Basic

I have 4 continous rotating servos used for wheels for a robot that will be going up the stairs, at this point it can go up the stairs.  I am wanting it to go up the stairs and then reverse servo directions and come straight back down.  So pretty much what I have in mind now is for the robot to climb for 100 seconds or so and then after that 100 seconds have it reverse and come back down to me.

I looked in the list of basic programming but couldn't quite find what I was looking for.  This is what I have going now.


servo 0,75

servo 1,75

servo 2,225

servo 3,225

pause 1000

goto main

What I was thinking is that after 100 seconds or so when it reached the top of the stairs in would reverse into


servo 0.225

servo 1,225

servo 2,75

servo 3,75

pause 1000

goto main


Does anyone know if what I am looking to do is possible with my approach?

Thank you.

Comment viewing options

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

You can use the settimer count command. As you are using servos, you can not use the internal timer at the same time as the servo command, as the servo command requires sole use of the timer to calculate the servo pulse intervals. Just connect an external clock output (for instance NE 555, wired as an astable oscillator) to the digital input pin 0.

Another possibility is the for...next command.