Book Image

Hands-On Embedded Programming with Qt

By : John Werner
Book Image

Hands-On Embedded Programming with Qt

By: John Werner

Overview of this book

Qt is an open source toolkit suitable for cross-platform and embedded application development. This book uses inductive teaching to help you learn how to create applications for embedded and Internet of Things (IoT) devices with Qt 5. You’ll start by learning to develop your very first application with Qt. Next, you’ll build on the first application by understanding new concepts through hands-on projects and written text. Each project will introduce new features that will help you transform your basic first project into a connected IoT application running on embedded hardware. In addition to gaining practical experience in developing an embedded Qt project, you will also gain valuable insights into best practices for Qt development and explore advanced techniques for testing, debugging, and monitoring the performance of Qt applications. The examples and projects covered throughout the book can be run both locally and on an embedded platform. By the end of this book, you will have the skills you need to use Qt 5 to confidently develop modern embedded applications.
Table of Contents (22 chapters)
Free Chapter
1
Section 1: Getting Started with Embedded Qt
5
Section 2: Working with Embedded Qt
10
Section 3: Deep Dive into Embedded Qt
14
Section 4: Advanced Techniques and Best Practices
Appendix A: BigProject Requirements

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...