Skip to main content

Python driver for Nintendo Switch Joy-Con

Project description


PyPI - Python Version PyPI - Implementation

Python driver for Nintendo Switch Joy-Con

We are referring to dekuNukem/Nintendo_Switch_Reverse_Engineering


pip install joycon-python hidapi pyglm


Quick status check

cd joycon-python/
python -m pyjoycon.joycon

or use as module

from pyjoycon import JoyCon, get_R_id

joycon_id = get_R_id()
joycon = JoyCon(*joycon_id)


Status values

  'battery': {
    'charging': 0,
    'level': 2
  'buttons': {
    'right': {
      'y': 0,
      'x': 0,
      'b': 0,
      'a': 0,
      'sr': 0,
      'sl': 0,
      'r': 0,
      'zr': 0
    'shared': {
      'minus': 0,
      'plus': 0,
      'r-stick': 0,
      'l-stick': 0,
      'home': 0,
      'capture': 0,
      'charging-grip': 0
    'left': {
      'down': 0,
      'up': 0,
      'right': 0,
      'left': 0,
      'sr': 0,
      'sl': 0,
      'l': 0,
      'zl': 0
  'analog-sticks': {
    'left': {
      'horizontal': 0,
      'vertical': 0
    'right': {
      'horizontal': 2170,
      'vertical': 1644
  'accel': {
    'x': 879,
    'y': 1272,
    'z': 549
  'gyro': {
    'x': -354,
    'y': -7,
    'z': 281

You need cython-hidapi to use Bluetooth / HID connection in Python.

Alternatively, you can use hid instead if cython-hidapi fails to find your JoyCons.


We have a specialized class which tracks the gyroscope for you, and exposes this tracked state in a simplified manner:

from pyjoycon import GyroTrackingJoyCon, get_R_id
import time

joycon_id = get_R_id()
joycon = GyroTrackingJoyCon(*joycon_id)
for i in range(20):
    print("joycon pointer:  ", joycon.pointer)
    print("joycon rotation: ", joycon.rotation)
    print("joycon direction:", joycon.direction)

Button events

We have a specialized class which tracks the state of the JoyCon buttons and provides changes as events. Here is an example of how it could be used with pygame:

from pyjoycon import ButtonEventJoyCon, get_R_id
import pygame

joycon_id = get_R_id()
joycon = ButtonEventJoyCon(*joycon_id)


while 1:


    for event_type, status in
        print(event_type, status)



Combining multiple JoyCon helper classes

import pyjoycon

class MyJoyCon(
    ): pass


  • macOS Mojave (10.14.6)
  • Python (3.7.4)
  • hidapi (0.7.99.post21)

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

joycon-python-0.2.4.tar.gz (9.1 kB view hashes)

Uploaded source

Built Distribution

joycon_python-0.2.4-py3-none-any.whl (10.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page