State Machines

This Blog entry is the 5th in a series intended primarily for FIRST Robotics Competition (FRC) teams and their mentors.

In this blog entry, I will discuss the idea of loop memory and how to modify your code to include it. I will also introduce the idea of a state machine and how they make your code more flexible and modular. In this example I code and explain the state machine for a mechanical lifting system.

I discuss:

  • Loop Memory
  • What state machines are
  • How to draw and interpret a basic state diagram
  • Creating typedefs for state machine data
  • Creating enums to store the actual state
  • How to write state machine code using the case structures

Follow Us on Twitter