Arduino hangs when working with relays and AC