I have a system that it is connected to a server by using a wifi. im currently using arduino uno wifi rev 2, it is powered by either of the two batteries. and there is a website that has two buttons “Battery 1” and “Battery 2” when i click the button 1 it will switch the relay and connects to the battery and vice versa.
now the problem that i’m encountering is that when it was switch once, (i think) the arduino resets the whole code. but i didnt see the relay being shut down nor the arduino.
This is my circuit diagram