def CommandBright(ser): szInput = input("{:15}".format("> Brightness")) try: listInput = list(map(int, szInput.strip().split(" "))) if len(listInput) != 1: printError(2, "Enter only 1 value for the percentage of brightness") else: tmp = True for i, val in enumerate(listInput): if 0 > val or val > 100: printError(2, "Enter percentage between 0-100") tmp = False break if tmp: sendPacket(ser, createPacket(OPCODE_BRIGTH, listInput)) except ValueError: printError(2, "Enter percentage value 0-100")
def CommandRGB(ser): szInput = input("{:15}".format("> [R][G][B]")) try: listInput = list(map(int, szInput.strip().split(" "))) if len(listInput) != 3: printError(2, "You must enter 3 int value for each component") else: tmp = True for i, val in enumerate(listInput): if 0 > val or val > 255: printError(2, "Enter value between 0-255") tmp = False break if tmp: sendPacket(ser, createPacket(OPCODE_RGB, listInput)) except ValueError: printError(2, "Enter int value 0-255")