Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Moving a random servo command

hi there

making some displays and i am using a micro maestro as the basis for each one. each one has 4 servos (powerhd LF-20s) that need to move to their full extent, delay an amount of time (could be random as well) and then move back. all acting independently of each other.

been trawling through the scripting guide and i cant see how i would do this with any amount of randomness without just scripting it in one by one.

if anyone has a guide they can link or can help i would be most grateful.

thank you

Hello.

As you mentioned, the Maestro scripting language does not have a built-in random number generator. However, there are some methods that might work. For example, Paul suggests computing a pseudo-random number sequence, taking an analog reading of a noisy input, or doing both in this forum thread.

Another idea might be to use the “GET_MS” command creatively. For example, if you have your script start with a button push, you could use GET_MS to measure the amount of time the button was held down for, and use that as a type of seed for your program. Or call GET_MS periodically in your script and use it to determine which subroutine to call next (e.g. if it is even call subroutine A, if it is odd call subroutine B).

Brandon