If you are having problems with the OI reading multiple clicks with one click due to your reaction time being slower then one loop on the processor you can do this:
Code:
static unsigned int loops = 30;
if (p1_sw_trig && loops >= 30)
{
relay1_fwd = !relay1_fwd;
relay1_rev = !relay1_fwd;
loops = 0;
}
if (loops < 30)
loops++;
Basically what this does is checks if the button is pushed every 30 processor cycles which with the default code is 786 ms (26.2 ms/Cycle * 30 Cycles). You can change the number from 30 to whatever you want!
Edit: Fixed a small bug