from machine import Pin
from time import sleep
relay1=Pin(20, Pin.OUT)
relay2=Pin(16, Pin.OUT)
relay3=Pin(19, Pin.OUT)
for i in range(1,10):
voice=input("Enter your speech word:")
if voice=="turn on the TV":
relay1.on()
print("TV ON")
elif voice=="turn on the HEATER":
relay2.on()
print("HEATER ON")
elif voice=="turn on the WI-FI Cable":
relay3.on()
print("WI-FI cable ON")
elif voice=="turn off the TV":
relay1.off()
print("TV OFF")
elif voice=="turn off the HEATER":
relay2.off()
print("HEATER OFF")
elif voice=="turn off the WI-FI cable":
relay3.off()
print("WI-FI cable OFF")
elif voice=="turn on the all":
relay1.on()
relay2.on()
relay3.on()
print("all the things ON")
elif voice=="turn off the all":
relay1.off()
relay2.off()
relay3.off()
print("all the things are OFF")
else:
print("Invalid command!")
sleep(1)