Writing a Logic File

Your logic file is the place for the superstructure of your subsystem. This file will manage the motors and inputs written in your IO and IONeo file and put them to use. This file will have 3 key parts a state machine, periodic functions, and tunable values.

State Machines

A key part of the logic file is a state machine. A state machine is a way to organize different tasks your subsystem needs to complete. For example if you were to make a state machine for an oven your states would be things like “off” “warming” “baking” “convection”. These are all different states the oven could be in. To start writing your state machines you will need an enumerated class with the names of all of your states. This class will go inside of a companion object. For our imaginary oven subsystem that would look something like this.

image_2024-01-23_202124678.png