Figure 3—A simple loop is used to monitor switch inputs, increment and decrement x- and y-axis variables, and communicate the values to an external digital poteniometer via an SPI interface.