I was running a program that controles two relays fromm 5v to 120v and before the for loop reached it's value to end it stopped. I have the button pulled to ground. Electrical interfere from the 120v maybe? Should the microcontroller be grounded to the 120v?
Void loop
digitalWrite (led,high)
If (digitalRead(button)==high){
a=1;
digitalWrite(led,low);
}
While (a==1){
For(x=0,x<20000,x++){
....
........}
a=0;
}