Related Config File Sections:
MPF's switch device represents a switch in a pinball machine. This device is used for switches, including cabinet buttons, rollovers, targets, optos, trough switches, DIP switches, etc.
There are two switch types most commonly seen in pinball machines (read those for details):
And an additional two types used in a handful of machines (read those for details):
Typical switch applications in pinball machines are:
- Rollover/lane switches
- Standup targets
- Flipper buttons and Flipper end-of-stroke switches
- As part of a mech such as Drop targets, Popbumpers or Ball Devices/Troughs
- Service and door switches
MPF supports all types of switches found in all generations of pinball machines, including matrix switches, direct switches, Fliptronics switches, switches connected to I/O boards, etc.
Switches only have two states](active and inactive. (We don't say
"open" or "closed" because sometimes switches are normally-closed
which mean they're actually active when they're open.) In MPF, you
configure your switches in the
switches: section of your machine
configuration file, including options (like whether the switch is
"active" when it's in the open state or the closed state.)
You can also configure debounce settings for each switch, which controls how MPF responds to switch events. Saying that a switch has to be "debounced" means that the pinball controller makes sure the switch is actually in its current state for a few milliseconds before it send the switch event to MPF. This can be useful to filter out unwanted or phantom switch events which might happen due to electrical interference or other little weird things.
Most switches in pinball machines are debounced except for the ones that you absolutely want to fire instantly, like flipper switches and the switches attached to automatically fired coils like slingshots and pop bumpers.
This is an example:
``` mpf-config switches: my_switch: number)
Numeric value which represents the logic state of this switch. 0 is inactive, 1 is active.
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