beautypg.com

Implementing an operating function, Mode 1 – Wavetronix Click 500 (programmable controller) (CLK-500) - Developer Guide User Manual

Page 44

background image

CHAPTER 4 • OPERATING FUNCTIONS AND MENU 43

Task A

Operating Mode 1

Operating Mode 2

Operating Mode 2

M

en

u

M

en

u

Time

1

2

3

4

5

Button Hold

Button Hold

Figure 4.3 – Mode and Task Timeline

Note

A button hold is different than a button press. A button press is applied for less than
1.5 seconds; a button hold is applied for more than 1.5 seconds. Hold the button down
to progress through the modes and tasks in the menu. A mode or task is not selected
until you follow a button hold with a button press.

Implementing an Operating Function

The following section contains a description of Mode 1 and Task A from the example code

at the end of this chapter (see Example Code 4.1 section).

Mode 1

Mode 1 begins with a setup function. In the example below, the setup function is called

Setup1 and will print the selections made to the menu.

void Setup1( void )
{
printf(“\n\nSetting up Mode 1...\n”);
printf(“Selection 1 (yellow bank) = %d \n”,
ClickMenuSelection1());
printf(“Selection 2 (red bank) = %d \n”,
ClickMenuSelection2());
printf(“Finished\n”);
}

The mode function will be called continuously after Setup1 returns. The mode function

(Mode1) prints “This is operating mode 1/n” in one second intervals.