user10817: No matter how I rearrange this, the increment compare always returns false....
I have even taken it out of the if, and put it in its own if:
int buttonFSM(button *ptrButton)
{ 
    int i;
    i = digitalRead(ptrButton->pin); 
    switch(ptrButton->buttonState)
    {
    case SW_UP:
        if(i==0 && ++ptrButton->debounceTics == DBNC_TICS) //swtich went down
        {
            ptrButton->buttonState = SW_DOWN;
            ptrButton->debounceTics = 0;
            return SW_TRANS_UD;       
        }
        ptrButton->debounceTics = 0;
        return SW_UP;
    case SW_DOWN:
        if(i==1 && ++ptrButton->debounceTics == DBNC_TICS) //switch is back up
        {
            ptrButton->buttonState = SW_UP;
            ptrButton->debounceTics = 0;
            return SW_TRANS_DU;       
        }
        ptrButton->debounceTics = 0;
        return SW_DOWN;   
    }
}


user10827: Looks to me like the path where the if doesn't happen are getting you. You don't show what DBNC_TICS is set to, but I'm assuming it's > 1.
ptrButton->debounceTics will never be greater than 1 because you always:
    ptrButton->debounceTics = 0;


10817: <p>No matter how I rearrange this, the increment compare always returns false....</p>

<p>I have even taken it out of the if, and put it in its own if:</p>

<pre><code>int buttonFSM(button *ptrButton)
{ 
    int i;
    i = digitalRead(ptrButton-&gt;pin); 
    switch(ptrButton-&gt;buttonState)
    {
    case SW_UP:
        if(i==0 &amp;&amp; ++ptrButton-&gt;debounceTics == DBNC_TICS) //swtich went down
        {
            ptrButton-&gt;buttonState = SW_DOWN;
            ptrButton-&gt;debounceTics = 0;
            return SW_TRANS_UD;       
        }
        ptrButton-&gt;debounceTics = 0;
        return SW_UP;
    case SW_DOWN:
        if(i==1 &amp;&amp; ++ptrButton-&gt;debounceTics == DBNC_TICS) //switch is back up
        {
            ptrButton-&gt;buttonState = SW_UP;
            ptrButton-&gt;debounceTics = 0;
            return SW_TRANS_DU;       
        }
        ptrButton-&gt;debounceTics = 0;
        return SW_DOWN;   
    }
}
</code></pre>
 10827: <p>Looks to me like the path where the if doesn't happen are getting you. You don't show what DBNC_TICS is set to, but I'm assuming it's > 1.</p>

<p>ptrButton->debounceTics will never be greater than 1 because you always:</p>

<pre><code>    ptrButton-&gt;debounceTics = 0;
</code></pre>
