element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
element14's The Ben Heck Show
  • Challenges & Projects
  • element14 presents
  • element14's The Ben Heck Show
  • More
  • Cancel
element14's The Ben Heck Show
Documents Mini Pinball 03: Codemania! SoundFX and State Machines -- Episode 295
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join element14's The Ben Heck Show to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Engagement
  • Author Author: randogless
  • Date Created: 22 Jun 2017 8:05 PM Date Created
  • Last Updated Last Updated: 16 Jun 2017 7:24 AM
  • Views 1390 views
  • Likes 5 likes
  • Comments 4 comments
Related
Recommended

Mini Pinball 03: Codemania! SoundFX and State Machines -- Episode 295

image

element14's The Ben Heck Show

Join the Ben Heck team every week for amazing hacks! Watch them build and mod community-inspired projects using electronics!

Back to The Ben Heck Show homepage image

Mini Pinball Kit
Featured Bonus Content
See All Episodes

 

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

It's time to code with Arduino and the Teensy 3.6 to create the game logic and sound for the Miniature Pinball machine. Using the C++ Programming language, Ben takes Felix's C code and makes it suitable for embedded microcontroller hardware with a logic state machine, this virtualised state machine monitors what is going on with the Pinball hardware, such as buttons and what the pinball touches, to react to it by increasing your score or playing music and sounds!

Disclaimer

  • hack
  • episode 295
  • codemania
  • ardexpert
  • episode 295: mini pinball 03: soundfx and state machine
  • heck
  • ben
  • tbhs_ep
  • Share
  • History
  • More
  • Cancel
  • Sign in to reply

Top Comments

  • DAB
    DAB over 8 years ago +1
    Nice episode. I would have preferred Ben do a quick drawing of the code design before he then jumped right into the details. He glossed over a lot of the design issues, which might have made it clearer…
  • tm14
    tm14 over 7 years ago +1
    That main loop bothers me, maybe it will be over polling to sense switch changes. I would think a timer interrupt would allow even/regular polling of switches. Individual states that take too long can…
  • tm14
    tm14 over 7 years ago

    That main loop bothers me, maybe it will be over polling to sense switch changes.  I would think a timer interrupt would allow even/regular polling of switches.  Individual states that take too long can be broken up into sub-states, that allow time to poll switches between the sub-states.  Shouldn't there be a halt instruction in there somewhere so the processor can go into a lower power state briefly when it has no work to do?  Maybe it will reduce electricity use and run cooler.

     

    Includes are mainly definitions.  I don't think they take up memory after compiling.  So including more than necessary doesn't hurt much.  Maybe there is a lint program that will tell you what isn't needed.

     

    How many processors will this pinball game need to run?  Can it be done with only one processor with efficient timer event driven code to save on costs?

     

    BTW, the archive list of shows now has episode 293 missing.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 8 years ago

    Nice episode.

     

    I would have preferred Ben do a quick drawing of the code design before he then jumped right into the details.

     

    He glossed over a lot of the design issues, which might have made it clearer when he cleaned up the code and broke the code into easier to maintain modules.

     

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • cstanton
    cstanton over 8 years ago in reply to jamesingham

    Maaaaaybe.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • jamesingham
    jamesingham over 8 years ago

    Is this not last weeks video?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube