Creating a command queue
There are two parts to the example-program: an app that runs on the development computer, and firmware that runs on the dev-board. The app is shown in Figure 13.1. The app sends commands over USB to the firmware. Each command specifies how the dev-board’s user-LEDs are to be displayed (green, red, and blue). For each LED, its brightness is specified. On the slider-bars, 0% is off, 100% is fully on, and partial brightness is in-between (e.g., 50% is half brightness). The slider-bars’ index is shown, and it ranges from 0 to 255. The commands sent by the app also specify whether the LEDs should shine continuously or blink.

Figure 13.1: The app that sends LED commands to the dev-board
While the example-program itself is very simple, the concepts presented scale extremely well. So, regardless of whether there are only a few commands or hundreds, the same approach can be used to keep an architecture flexible.
The example-program also...