Skip to main content

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)

Uploaded Source

Built Distributions

eightbitdo_zero2-0.1.3-py3.8.egg (5.7 kB view hashes)

Uploaded Source

eightbitdo_zero2-0.1.3-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page