Warning

This is the dev documentation for an unreleased version of MPF!

This is the documentation for MPF 0.54+, which is the “dev” (next) release of MPF that is a work-in-progress. Unless you’re specifically looking for this version, you probably want to use the version of documentation called “latest” which is for the latest released version of MPF. That documentation is at docs.missionpinball.org/en/latest.

Spinners

Related Config File Sections
switches:

Spinners are rotating metal plates which close a switch once per rotation.

Hardware

../../_images/spinner.jpg

Part numbers:

  • Stern: #511-5113-00 or #100-0014-00

Config

In MPF spinners are configured just like normal switches:

switches:
  s_my_spinner:
    number: 42    # number depends on your platform
This example is tested to be valid MPF config. However, it is not integration tested.
switches:
  s_my_spinner:
    number: 42    # number depends on your platform

It is very common to count the rotations of your spinner per player. You can eiher use a player variable or a counter for that. This is an example:

switches:
  s_my_spinner:
    number: 42   # number depends on your platform
##! mode: my_mode
# in your base mode add 1 for every rotation to a player variable which you can use in slides
variable_player:
  s_my_spinner_active:
    spinner_rotations: 1
# in a game mode the player needs to spin the spinner 10 times
counters:
  spinner_rotations:
    count_events: s_my_spinner_active
    count_complete_value: 10
    events_when_complete: mode_finished
This example is tested to be valid MPF config. Additionally, our integration test passed. Click to show the test and full config.
switches:
  s_my_spinner:
    number: 42   # number depends on your platform
##! mode: my_mode
# in your base mode add 1 for every rotation to a player variable which you can use in slides
variable_player:
  s_my_spinner_active:
    spinner_rotations: 1
# in a game mode the player needs to spin the spinner 10 times
counters:
  spinner_rotations:
    count_events: s_my_spinner_active
    count_complete_value: 10
    events_when_complete: mode_finished
##! test
start_game
start_mode my_mode
hit_and_release_switch s_my_spinner
mock_event mode_finished
assert_player_variable 1 spinner_rotations
hit_and_release_switch s_my_spinner
hit_and_release_switch s_my_spinner
hit_and_release_switch s_my_spinner
hit_and_release_switch s_my_spinner
hit_and_release_switch s_my_spinner
hit_and_release_switch s_my_spinner
hit_and_release_switch s_my_spinner
hit_and_release_switch s_my_spinner
assert_event_not_called mode_finished
hit_and_release_switch s_my_spinner
assert_event_called mode_finished
assert_player_variable 10 spinner_rotations