Main Sequencer Variables
The Mute Sequencer is an 8 track step sequencer, storing boolean values for the mute status. The maximum sequence length is 255 steps with 8 tracks containing the mute values. Length is the current sequence length (minimum 1, max 255) and step is the current step number. So if you look at sequencer[TRACK_1] you'd get the boolean value for Track 1 at step 3.
boolean sequencer[step][track] byte length byte step
To not get confused on the boolean value for mute/unmute, we also #define their values. And because tracks are 1 indexed physically, and 0 indexed logically we'll also add in #defines for them too. These will also double as their button numbers.
define MUTE false define UNMUTE true define TRACK_1 0 define TRACK_2_ 1 define TRACK_3 2 define TRACK_4 3 define TRACK_5 4 define TRACK_6 5 define TRACK_7 6 define TRACK_8 7
Buttons have a few arrays to allow debounce and have state change flags for rising edge / falling edge logic.
boolean button_current_state[button] boolean button_last_poll[button] boolean button_changed[button]
LEDs are a bit simpler, as they are just an array, but because we're controlling LED intensity as well, they are actually byte arrays for 0-255:
And adding a few more defines for the rest of the buttons and modes. (Mode is the general state machine state, of which we have 4)