Optoisolator, did I connected it right? (Arduino Uno)
Are you connecting a 10k between 5V and pin number 5? If not, you may have damaged the opto-isolator. The 10k is necessary to give a place for voltage to drop when the opto turns on.  Also like jms said, you probably want to do something like zeroState = !zeroState; 

If you think of the pins 4 &amp; 5 of the opto as a switch, ideally if you through the switch it would conduct all the voltage from 5V to ground. Now, if 5V was an ideal supply, that means I = V/R , I = 5V/0 which is infinite. Now in reality what is happening is the switch closed and you probably exceeded the maximum power dissipation of the transistor in the opto, which in this case is 200mW. Might have broke it, might not. Just check it with a voltmeter that has diode mode, pin 5-4 should be about 0.7V forward and inf or open with the leads reversed and pin 5-6 is about 0.7V and inf of open when the leads are reversed.