beautypg.com

Task a, The menu structure – Wavetronix Click 500 (programmable controller) (CLK-500) - Developer Guide User Manual

Page 45

background image

44

CHAPTER 4 • OPERATING FUNCTIONS AND MENU

void Mode1( void )
{
printf(“This is operating mode 1\n”);
ClickUtilPause(1000);
}

Task A

When Task A is selected from the menu, it will change the color of the text displayed in

the STDIO window. The text color is based on the first submenu choice. Once this task is

complete, the mode that was running prior to Task A will be restarted.

void TaskA( void )
{
printf(“\n\nRunning Task A...”);
if (ClickMenuSelection1() == 1)

ChangeTextColor( STDIO_BLUE );

if (ClickMenuSelection1() == 2)

ChangeTextColor( STDIO_RED );

if (ClickMenuSelection1() == 3)

ChangeTextColor( STDIO_GREEN );

if (ClickMenuSelection1() == 4)

ChangeTextColor( STDIO_BLACK );

printf(“Finished\n”);
}

The Menu Structure

Figure 4.4 shows an example of a menu structure (Example Code 4.1 shows the code used

to create this menu). Mode 1 is displayed on the menu as a solid blue LED and contains two

submenus with selections that are displayed on the yellow and red banks of LEDs. Task A is

displayed on the menu as a solid yellow LED and has one submenu that changes the color

of printed text. The Task A submenu selections are in the yellow LED bank.