Coder Social home page Coder Social logo

joycon's Introduction

joycon

Nintendo Switch's Joycon Device access library(via bluetooth only)

Reverse engineering info

https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering

Feature

  • supported deveces: Joycon(L/R), Pro-Controller
  • get: Digial Buttons state
  • get: Analog Sticks state
  • set: Raw Vibration data
  • calibration support for analog stick.

Dependencies

  • go get -u github.com/flynn/hid
  • go get -u github.com/shibukawa/gotomation optional

Usage

In advance, you perform Bluetooth pairing for Joycon. (Joycon must be connected before execute below code.)

Note: When Joycon is fitted to the main body, BT sessions are overwritten, so when you connect to PC later, you need to redo pairing.

package main

import "github.com/nobonobo/joycon"

func main() {
    devices, err := joycon.Search(joycon.JoyConL)
    if err != nil {
        log.Fatalln(err)
    }
    jc, err := joycon.NewJoycon(devices[0].Path, false)
    if err != nil {
        log.Fatalln(err)
    }
    s := <-jc.State()
    fmt.Println(s.Buttons)  // Button bits
    fmt.Println(s.LeftAdj)  // Left Analog Stick State
    fmt.Println(s.RightAdj) // Right Analog Stick State
    a := <-jc.Sensor()
    fmt.Println(a.Accel) // Acceleration Sensor State
    fmt.Println(a.Gyro)  // Gyro Sensor State

    jc.Close()
}

TODO

  • Deadzone parameter read from SPI memory.
  • Rich Vibration support.
  • Set Player LED.
  • Set HomeButton LED.
  • Low power mode support.
  • IR sensor capture.(wip)

joycon's People

Contributors

nobonobo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

joycon's Issues

quick question

I've been hacking around with Joy-Cons via a raw HID reader and I was wondering are the two analog sticks limited to being 8-directional D-PADs as is the default with no calibration, or are they capable of something more analog?

*

Old request. Delete issue please.

The process cannot access the file

Hello, I wanted to test the sample code and it didn't work.

I always have a error "2022/09/07 23:58:05 The process cannot access the file because it is being used by another process.".
I don't see any application which can use a joycons.

Is there a any way to track what program is using my joycons or force the program to use a joycons?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.