Code works once, then I have to power off and on to work again.

Hello,

I have a very simple system for a lock in my door. A servo and a RC controller to lock and unlock the door. It's been working fine for about 7 months now until today for some reason. I used to press the button to toggle the lock. Now when I press the toggle button 2 times, the 3rd does nothing. When i disconnect the power and connect it again it works again for 2 times. Any ideas?

Post your circuit diagram and arduino sketch.
A component breakdown could be a cause especially if you have used capacitors where the voltage rating is too low, used an incorrect power supply, or omitted a flyback diode etc.
Reloading the sketch could, under some unlikely circumstances, correct the issue.

6v6gt:
Post your circuit diagram and arduino sketch.
A component breakdown could be a cause especially if you have used capacitors where the voltage rating is too low, used an incorrect power supply, or omitted a flyback diode etc.
Reloading the sketch could, under some unlikely circumstances, correct the issue.

Reloading the sketch somehow fixed the issue.

bananamasterz:
Reloading the sketch somehow fixed the issue.

Cosmic rays flipping bits in the device's flash memory ? Anyway, good that it is fixed.

6v6gt:
Cosmic rays flipping bits in the device's flash memory ? Anyway, good that it is fixed.

Could it be that the memory chip is going bad?

Could be just that one single cosmic ray.