diff --git a/code.py b/code.py index 70b09b4..1f9a26a 100644 --- a/code.py +++ b/code.py @@ -22,6 +22,15 @@ buttonTwo.pull = Pull.UP buttonThree = DigitalInOut(board.GP2) buttonThree.pull = Pull.UP +buttonFour = DigitalInOut(board.GP3) +buttonFour.pull = Pull.UP + +buttonFive = DigitalInOut(board.GP4) +buttonFive.pull = Pull.UP + +buttonSix = DigitalInOut(board.GP5) +buttonSix.pull = Pull.UP + kbd = Keyboard(usb_hid.devices) layout = KeyboardLayout(kbd) @@ -146,9 +155,299 @@ def macro_parser(macroFileName=(str)): time.sleep(0.1) - kbd.send(Keycode.TAB) + kbd.send(Keycode.TAB) + + if line == "f24": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F24) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F24) + + if line == "f23": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F23) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F23) + if line == "f22": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F22) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F22) + + if line == "f21": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F21) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F21) + + if line == "f20": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F20) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F20) + + if line == "f19": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F19) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F19) + + if line == "f18": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F18) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F18) + + if line == "f17": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F17) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F17) + + if line == "f16": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F16) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F16) + + if line == "f15": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F15) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F15) + + if line == "f14": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F14) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F14) + + if line == "f13": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F13) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F13) + + if line == "f12": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F12) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F12) + + if line == "f11": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F11) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F11) + + if line == "f10": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F10) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F10) + + if line == "f9": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F9) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F9) + + if line == "f8": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F8) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F8) + + + if line == "f7": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F7) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F7) + + if line == "f6": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F6) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F6) + + if line == "f5": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F5) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F5) + + if line == "f4": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F4) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F4) + + + if line == "f3": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F3) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F3) + + + if line == "f2": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F2) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F2) + + if line == "f1": + + if holdingKeys == 1: + + keysToPress.append(Keycode.F1) + + else: + + time.sleep(0.1) + + kbd.send(Keycode.F1) if line == "windows": @@ -384,7 +683,9 @@ def macro_parser(macroFileName=(str)): time.sleep(0.5) while True: - + + lcd.setCursor(0,0) + if not buttonOne.value: lcd.clear() lcd.setCursor(0,0) @@ -420,7 +721,19 @@ while True: lcd.clear() - lcd.setCursor(0,0) + elif not buttonFour.value: + lcd.clear() + lcd.setCursor(0,0) + lcd.printout("TF2 Binds") + time.sleep(1) + lcd.clear() + + macro_parser("tf2binds.mcr") + + + lcd.clear + + lcd.setCursor(0,0) lcd.printout("Kico v4")