I'm revising the code to this. Any thoughts?
I'm not near my arduino now.
- You should make both debounce and time unsigned long.
- I would enable the pullup on pinButton using digitalWrite(pinButton,HIGH);
- I would have all I/Ps buffered with an Opto Isolator.
- The I/P to pinButton has to be normally low going high on a push.
- I think you will toggle the light if you hold pinButton down (HIGH).