Python code to use thev 8bitdo zero2 controller with a Raspberry Pi
Project description
8bitdo zero2
Python code to use the 8bitdo zero2 controller with a Raspberry Pi.
How to use
Installation
$ pip install eightbitdo-zero2
Usage example
from gpiozero import LED
from eightbitdo_zero2 import EightBitDoZero2
# led
red = LED(17)
blue = LED(10)
def main():
# Initialize controller
controller = EightBitDoZero2(
on_y=red.on,
off_y=red.off,
on_a=blue.on,
off_a=blue.off,
)
# Start listen
controller.listen()
if __name__ == "__main__":
main()
There are more example code in examples.
Options
Controller initialize options.
name | type | default | detail |
---|---|---|---|
device_path | string | "/dev/input/js0" | File path to which device is connected. |
debug | boolean | False | Debug mode setting. When True, The entered command is displayed on STDOUT. |
on_<button_name> | function | lambda: None | Action when the button is pressed. |
off_<button_name> | function | lambda: None | Action when the button is Released. |
License
This software is released under the MIT License, see LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
eightbitdo_zero2-0.1.3.tar.gz
(3.9 kB
view hashes)
Built Distributions
Close
Hashes for eightbitdo_zero2-0.1.3-py3.8.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb0b2ef6ce11736eb1b59763dd7f0d5f3808b8f168bb390a989e51a680aac3be |
|
MD5 | 406df4cc4c993212efbcedc8949c6261 |
|
BLAKE2b-256 | 42a36cb5652314480137e70d5ff3c64e06f1c91d3fe4392b454a15536bc47852 |
Close
Hashes for eightbitdo_zero2-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3dc439d603ef317b134a43e01e997b31c76023f0d509438fd5780287241c39fe |
|
MD5 | f1491ab0fc525ecc839354ad1b36594f |
|
BLAKE2b-256 | 430ba7a66594c5c5359c1d5d9dba79490641bcce468db10e784667c321a00ffc |