The Arduino home automation Main Program The Arduino Main Program: detect the input and drive the output Next…