The Flow Chart of Fig-1 has described the solution to the problem of turing On/Off the Motor when the Button is pressed. Convert it into programming codes and execute on Arduino UNO.