fixing the SoundMachine program’s volume display
The SoundMachine program from Chapter 8 allows you to control the Volume and Tone of a Sound block using the TriBot’s two wheels, but the way the program displays the Volume level is not quite correct. Although the Sound block accepts values in the range of 0 to 100 for the Volume, the block really supports only five volume settings. In effect, the input value is rounded down to 0, 25, 50, 75, or 100.
In this section, you’ll improve the program by displaying a description for the Volume instead of a number. To do so, you’ll use a Switch block with six choices to convert the numeric Volume setting to a text description.
The first step is to change the Volume to one of six possible values to match the ...
Get The Art of LEGO MINDSTORMS NXT-G Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.