Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nobonobo/joycon
Device access library for Joycon(Nintendo Switch)
https://github.com/nobonobo/joycon
bluetooth controllers go joycon nintendo-switch
Last synced: 22 days ago
JSON representation
Device access library for Joycon(Nintendo Switch)
- Host: GitHub
- URL: https://github.com/nobonobo/joycon
- Owner: nobonobo
- License: mit
- Created: 2017-12-12T00:14:49.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-20T09:20:31.000Z (almost 7 years ago)
- Last Synced: 2024-06-19T05:43:47.299Z (6 months ago)
- Topics: bluetooth, controllers, go, joycon, nintendo-switch
- Language: Go
- Size: 31.3 KB
- Stars: 62
- Watchers: 9
- Forks: 15
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
```go
package mainimport "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 Statejc.Close()
}
```
## TODO- [ ] Deadzone parameter read from SPI memory.
- [x] Rich Vibration support.
- [ ] Set Player LED.
- [ ] Set HomeButton LED.
- [ ] Low power mode support.
- [ ] IR sensor capture.(wip)