beautypg.com

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

Page 103

background image

102

CHAPTER 9 • DIGITAL INPUT/OUTPUT

break;
case DUAL_INDICATION:
ClickLedflash(RED4,FLASH_SLOW);
break;

default:
}

IndicationStateLast = IndicationStateCurr;
}

char ReadInputs( void )
{
char inputState;

FilterInputs();
if ((Input1Red==1) && (Input2Yellow==0))
{
inputState = RED_INDICATION;
}
else if ((Input1Red==0) && (Input2Yellow==1))
{
inputState = YELLOW_INDICATION;
}
else if ((Input1Red==0) && (Input2Yellow==0))
{
inputState = GREEN_INDICATION;
}
else //if ((Input1Red==1) && (Input2Yellow==1))
{
inputState = DUAL_INDICATION;
}
return inputState;
}

void FilterInputs( void )
{
int i;
int inputRawCurr[2];
static int inputRawPrev[2];
static int tickCounter[2];