Scripts to interact with your Lego Dimensions pad (USB ID 0e6f:0241), for Python 3.
legousb-colorcycle.pycycles the whole pad through a few colours, then turns it off.legousbtag.pylights a pad green when a tag is placed on it (red for the tag set inuidDarthVader) and turns it off when the tag is lifted. Press Ctrl+C to stop.legopad-colorbank.txtlists colour values to use in your own scripts.
pip install -r requirements.txt
pyusb needs the libusb library: it's libusb1 on Fedora, libusb-1.0-0 on Debian/Ubuntu, and brew install libusb on macOS. On Windows, use Zadig to switch the pad to the WinUSB driver.
On Linux the scripts need root unless you add a udev rule, for example /etc/udev/rules.d/50-lego-dimensions.rules:
SUBSYSTEM=="usb", ATTRS{idVendor}=="0e6f", ATTRS{idProduct}=="0241", TAG+="uaccess"
Then run sudo udevadm control --reload and plug the pad back in.
python3 legousb-colorcycle.py
python3 legousbtag.py