import time 
import serial 

ser= serial.Serial("/dev/ttyACM0", baudrate=9600) 

try: 
	while True: 
		comando = input("Ingresar comando (on/off): ")
		comando = comando +"\n"
		comandoBytes=comando.encode()
		ser.write(comandoBytes)
		time.sleep(0.1)
		read= ser.readline()
		print(read)

except KeyboardInterrupt: 
	print("\nInterrupcion por teclado")
except ValueError as ve: 
	print(ve)
	print("Otra interrupcion")
finally:
	 ser.close()

38a93c25d601cc9549531354c71a50deddbd6fb0
<mask token>

<mask token>
try:
    while True:
        comando = input('Ingresar comando (on/off): ')
        comando = comando + '\n'
        comandoBytes = comando.encode()
        ser.write(comandoBytes)
        time.sleep(0.1)
        read = ser.readline()
        print(read)
except KeyboardInterrupt:
    print('\nInterrupcion por teclado')
except ValueError as ve:
    print(ve)
    print('Otra interrupcion')
finally:
    ser.close()

<mask token>
ser = serial.Serial('/dev/ttyACM0', baudrate=9600)
try:
    while True:
        comando = input('Ingresar comando (on/off): ')
        comando = comando + '\n'
        comandoBytes = comando.encode()
        ser.write(comandoBytes)
        time.sleep(0.1)
        read = ser.readline()
        print(read)
except KeyboardInterrupt:
    print('\nInterrupcion por teclado')
except ValueError as ve:
    print(ve)
    print('Otra interrupcion')
finally:
    ser.close()

import time
import serial
ser = serial.Serial('/dev/ttyACM0', baudrate=9600)
try:
    while True:
        comando = input('Ingresar comando (on/off): ')
        comando = comando + '\n'
        comandoBytes = comando.encode()
        ser.write(comandoBytes)
        time.sleep(0.1)
        read = ser.readline()
        print(read)
except KeyboardInterrupt:
    print('\nInterrupcion por teclado')
except ValueError as ve:
    print(ve)
    print('Otra interrupcion')
finally:
    ser.close()

import time 
import serial 

ser= serial.Serial("/dev/ttyACM0", baudrate=9600) 

try: 
	while True: 
		comando = input("Ingresar comando (on/off): ")
		comando = comando +"\n"
		comandoBytes=comando.encode()
		ser.write(comandoBytes)
		time.sleep(0.1)
		read= ser.readline()
		print(read)

except KeyboardInterrupt: 
	print("\nInterrupcion por teclado")
except ValueError as ve: 
	print(ve)
	print("Otra interrupcion")
finally:
	 ser.close()
