TipJar #13 - State Machines: Writing Flexible, Modular Code. Lifter Mechanism Example.


Updated 2010 FRC Videos Now Online:


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

In this blog entry, I discuss how to use a state machine within LabVIEW to write flexible, modular code. In this example I code and explain the state machine for a mechanical lifting system. much like what many FRC teams may use.

I discuss:
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
Storing all sensor inputs and machine outputs in the state machine data for use in debugging and/or the dashboard program
How to write the state machine code using the case structure, including how to speed up development by duplicating similar cases

Sample code is listed below.

Please! If you like (or hate) what you saw, please leave a comment by clicking here.

Also, don't forget to check out the rest of the series by clicking on the left side of the page.

Ben Zimmer
-- LV Mastery Team

Trouble viewing these videos? Please click here to install the latest version of flash.

Testimonials

Want to See More?

Already Registered?

Links:
FIRST Robotics Competition Website.

Subscribe:
Follow this link to be notified whenever something new is added to the "Tip Jar".