void gapTimer()
{
...
if ( x == 499 )
{
...
arrayCounter = 0;
...
}
...
}
void switchTrack()
{
if ( arrayCounter == 500 )
{
...
if ( (1 == timerSwitchA && (2 == timerSwitchB) )
{
gapTimer();
}
}
As seen above within 'gapTimer' you reset 'arrayCounter' if 'x' is 499, then back at the top of 'switchTrack' is a check for a condition that will never happen!