while(True): if uart.any(): color = uart.readline().decode() if color == "red\r": pass