Skip to content

Programming Servo Sequences

Related Config File Sections:

You often want to move servos to different positions sequentially. For instance, an animated toy should open and close its mouth three times on a hit to a target. The target will post one event and you could use that to move the servo to one position. Servos do not prove position feedback so there is no way to trigger something on arrival at that position (unless you add additional switches). Instead you usually create a show which triggers a timed series of movements. The advantage of this solution is that you can easily integrate and synchonize it with sounds and lights.

The following example will move the servo six times when my_toy_hit is posted (three times to open and three times to close):

      0.0: open_mouth
      1.0: close_mouth
    reset_position: 1.0
    number: 1
    - duration: 1s
      events: open_mouth
    - duration: 2s
      events: close_mouth
      loops: 2

To see how this can be used in a real machine we recommend this explanation video by the pinball amigos:

You might also enjoy our video about servos in general:

Something missing or wrong? You can fix it!

This website is edited by people like you! Is something wrong or missing? Is something out of date, or can you explain it better?

Please help us! You can fix it yourself and be an official "open source" contributor!

It's easy! See our Beginner's guide to editing the docs.

Page navigation via the keyboard: < >

You can navigate this site via the keyboard. There are two modes:

General navigation, when search is not focused:

  • F , S , / : open search dialog
  • P , , : go to previous page
  • N , . : go to next page

While using the search function:

  • Down , Up : select next / previous result
  • Esc , Tab : close search
  • Enter : go to highlighted page in the results