StateSmith State Machine Generator

StateSmith lets you code state machines visually.

Jeremy Cook
3 years ago

A state machine can be defined as a behavior model where something can be in one, and only one, state at one time. Such machines can be set up via traditional programming methods, but as seen here, Adam Fraser-Kruck has developed StateSmith as a cross platform free/open source tool for visually generating this type of program.

The resulting code is human readable, without dependencies, and is suitable for use with microcontrollers, kernels, or servers. The eventual goal is to get StateSmith to generate code in a variety of languages, but as of this writing it’s focused on C or C++. So it could be perfect for Arduino-based boards, but setups that run a variation of Python or another language may have to wait to use StateSmith.

Fraser-Kruck created this coding tool because he couldn’t find a state machine generator that was usable for low-level embedded applications, which was also enjoyable to use, and features an attractive license. StateSmith is meant to be easy to simply get started coding, and even allows you to input pseudo-code, then refine it into a usable program. The system's GUI displays the state's code for your perusal as well.

Several examples are shown via the project’s github page, and you can find the most complicated example, an Arduino Uno laser tag menu simulated here on Wokwi. StateSmith is ready to use right now, but Fraser-Kruck has big future plans for it, including additional languages and even a draw.io vscode extension. Be sure to give it a try, and if you really like it, he’s looking for at least one additional contributor to the project!

Jeremy Cook
Engineer, maker of random contraptions, love learning about tech. Write for various publications, including Hackster!
Latest articles
Sponsored articles
Related articles
Get our weekly newsletter when you join Hackster.
Latest articles
Read more
Related articles