beautypg.com

Wavetronix Click 500 (programmable controller) (CLK-500) - Developer Guide User Manual

Page 55

background image

54

CHAPTER 5 • LED AND PUSH-BUTTON FUNCTIONS

///////////////////////////////////////////////////////////////
// ExampleCode5.1.C
///////////////////////////////////////////////////////////////

#use click500menu.lib

void Setup( void );
void Mode( void );

void main( void )
{
ClickMenuAddMode( Mode, Setup, BLUE, 3, 0 );
ClickMenuStart();
}

void Mode( void )
{
if (ClickBtnPressed())
{
printf(“The button was pressed.\n”);
ClickLedOff(ALL);
printf(“All LEDs were turned off.\n”);
}
}

void Setup( void )
{
if (ClickMenuSelection1() == 1)
ClickLedOn(YELLOW1);
if (ClickMenuSelection1() == 2)
ClickLedflash(ALL, FLASH_FAST);
if (ClickMenuSelection1() == 3)
ClickLedHold(ALLYELLOW, 3000);
}