XboxController-Python

A python module to read XboxController inputs under Windows 10.

PyPI Github

Quick Reference

import time
import sys

from cc.xboxcontroller import XboxController, Hand

def main():
    """
    """
    stick = XboxController(0)

    while True:
        stick.update()
        stick.setRumble(Hand.LEFT, abs(stick.axes["LTrigger"]))
        stick.setRumble(Hand.RIGHT, abs(stick.axes["RTrigger"]))
        print("A Btn:", stick.getAButton(), end="")
        print("\tPOV:", stick.getPOV(), end="")
        print("\tX Axis:", stick.getX(Hand.LEFT))
        time.sleep(.01)


if __name__ == "__main__":
    main()
      

NewLine Serialization Method

A minimalistic communication protocol designed for various serial communication scenarios.

Spec

Quick Reference

Name Description Value (HEX)
END End of frame 0x0A
ESC Escape 0x0B
ESC_END Escaped end of frame 0x1A
ESC_ESC Escaped escape 0x1B