Tutorial 11: Add the rest of your coils and switches
This is part of our Getting Started guide.
The guide starts here.
It's been awhile since this tutorial has been updated. If you find anything that is no longer relevant, please let us know, or better yet, edit or update it yourself!
Okay, so at this point you have a working game. The biggest problem you
might run into is that if you shoot your ball into a playfield device
like a VUK or popper, the ball will get stuck. Why? Because you haven't
yet added the switches to your config file while let MPF know that a
ball is there, and you haven't added the coils which MPF needs to fire
to eject a ball. So MPF literally has no idea that those switches and
coils even exist, which means it has no ability to detect a ball
entering a device and to eject it. So when we're building a config for
a new game, at this point we go through our config and add all the
remaining switches and coils to and
coils: sections of
the config file.
1. Add the rest of your switches
This step is pretty simple. If you building a config for an existing
machine, we usually use the operators manual as our starting point and
just move down the list and add all the switches as they're listed in
there. We don't worry about tags at this point except for
playfield_active tag. We add this tag to any switch the ball can hit
when it's active and rolling around on the playfield. (So this is going
to be your lanes, slingshots, pop bumpers, ramp entry & exit switches,
rollovers, stand up targets, and anything else the ball can hit when
it's in motion. The tricky thing is that you do not add a
playfield_active tag to switches in other ball devices (drop_targets,
kickbacks, troughs or the shooter lane). For example, if you have a hole
in the playfield that the ball rolls into which requires a coil pulse to
kick it out of -- that is not a playfield switch (since when the ball
is in that hole, it's not actively rolling around the playfield).
We'll actually set that switch up as a part of a ball device in a later
2. Add the rest of your coils
Next add entries for the rest of your coils, again using the operators manual as a guide if you're building a config for an existing machine. You don't have to worry about pulse times at this point---just get the coils added.
Check out the complete config.yaml file so far
If you want to see a complete
config.yaml file up to this point, it's
You can run this file directly by switching to that folder and then running the following command:
C:\mpf-examples\tutorial>mpf both -X
Note that starting with this step, the actual coil, switch, and ball_device names don't 100% match with what we have in the tutorial. This shows you that there are lots of different options when it comes to naming things.
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