Estou tentando comunicar um código python e o arduino, porém ele não esta retornando o valor para acender o LED.
Já esta tudo configurado, pip, pyserial etc.
import serial
import time
import os
conexao = serial.Serial('COM3', 9600)
def menu():
os.system('cls') or None
print("""
CONTROLE DO LED
1- ON
2- OFF
""")
op = int(input("OPTION: "))
if op == 1:
try:
conexao.write(1)
print("LED LIGADO")
time.sleep(1)
print("RETORNANDO AO MENU")
time.sleep(1)
return menu()
except:
print("HOUVE ALGUM ERRO")
print("RETORNANOD AO MENU")
time.sleep(2)
return menu()
if op == 2:
try:
conexao.write(2)
print("LED DESLIGADO")
time.sleep(1)
print("RETORNANDO AO MENU")
return menu()
except:
print("HOUVE ALGUM ERRO")
print("RETORNANOD AO MENU")
time.sleep(2)
return menu()
menu()
"HOUVE ALGUM ERRO"
ou simplesmente não faz nada? Edite a pergunta e adicione essas informações.