Python y Arduino

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
CommSerie - Comunicacion serie con arduino.
Autor: Simón Martínez [simon @ cicoss.net]
Fecha: lunes, 10 de diciembre de 2018
"""

import serial, time

tLetra = {
"normal" : chr(27) + "[0m",
"gris" : chr(27) + "[1;30m",
"naranja" : chr(27) + "[1;31m",
"verde-clara" : chr(27) + "[1;32m",
"amarilla" : chr(27) + "[1;33m",
"azul-clara" : chr(27) + "[1;34m",
"morada-clara" : chr(27) + "[1;35m",
"cian-clara" : chr(27) + "[1;36m",
"blanca" : chr(27) + "[1;37m",
"negra" : chr(27) + "[0;30m",
"roja" : chr(27) + "[0;31m",
"verde" : chr(27) + "[0;32m",
"marron" : chr(27) + "[0;33m",
"azul" : chr(27) + "[0;34m",
"morada" : chr(27) + "[0;35m",
"cian" : chr(27) + "[0;36m",
"gris-clara" : chr(27) + "[0;37m"
}

puerto = "/dev/ttyACM0"
gap = 2                                # desfase retardo en segundos
estadoLed = ("Off", "On")

def leeSerial():
"""
Lee el puerto serie del arduino
"""
cadena = ""
while arduino.in_waiting == 0:
time.sleep(1)
while len(cadena) == 0:
while True:
c = arduino.read().decode()
if (c != "\n") and (c != "\r"):
cadena += c