Reader small image

You're reading from  Hands-On Embedded Programming with Qt

Product typeBook
Published inJul 2019
Reading LevelIntermediate
PublisherPackt
ISBN-139781789952063
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
John Werner
John Werner
author image
John Werner

John Werner is an internationally published author, engineer, consultant, and conference speaker with more than 15 years' experience. He has earned patents for inventions ranging from Inkjet printers to automotive ignition systems. John was one of the early users of Qt on QNX and contributed to the early knowledge of how to make it work. He is a contributor to the Qt-related information on Stack Exchange. He is currently a senior software engineer, specializing in Qt development, for Caliber Imaging & Diagnostics.
Read more about John Werner

Right arrow

Designing with state machines

For all of my professional career, I have been working with state machines in one form or another, and I used to hate implementing them. Since most of the code in my early career was done on a true microcontroller in a single thread, implementing a state machine meant having a state variable that indicated the current state and a giant case statement for each state. The state machine was easy to draw, but quite painful to implement and even worse to change.

Still, for some things, state machines really are the right way to go—especially when you're implementing a control system.

A finite-state machine (or state machine for short) is a model of a system with a finite set of conditions (states) and rules or events that cause a transition between conditions. I'll explain them more in the next section.

In this section, we will implement...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Hands-On Embedded Programming with Qt
Published in: Jul 2019Publisher: PacktISBN-13: 9781789952063

Author (1)

author image
John Werner

John Werner is an internationally published author, engineer, consultant, and conference speaker with more than 15 years' experience. He has earned patents for inventions ranging from Inkjet printers to automotive ignition systems. John was one of the early users of Qt on QNX and contributed to the early knowledge of how to make it work. He is a contributor to the Qt-related information on Stack Exchange. He is currently a senior software engineer, specializing in Qt development, for Caliber Imaging & Diagnostics.
Read more about John Werner