Skip to content

Comments

add pro controller#2

Open
kimizuka wants to merge 2 commits intosuchipi:masterfrom
kimizuka:feature/add-pro-controller
Open

add pro controller#2
kimizuka wants to merge 2 commits intosuchipi:masterfrom
kimizuka:feature/add-pro-controller

Conversation

@kimizuka
Copy link

@kimizuka kimizuka commented Jul 2, 2020

I want to use a pro controller.(https://www.nintendo.co.jp/hardware/switch/accessories/)
I'm worried about the behavior of the analog stick. However, I confirmed the behavior of other buttons.

const { listConnectedJoyCons } = require('./index.js');
const devices = listConnectedJoyCons();
const pro = devices[0].open();

[
  'dpadUp',
  'dpadDown',
  'dpadLeft',
  'dpadRight',
  'a',
  'x',
  'b',
  'y',
  'minus',
  'plus',
  'screenshot',
  'home',
  'l',
  'r',
  'zl',
  'zr',
  'analogStickLPress',
  'analogStickRPress',
  'analogStickL',
  'analogStickR'
].forEach((name) => {
  pro.on(`down:${name}`, () => {
    console.log(`down:${name}`);
  });

  pro.on(`up:${name}`, () => {
    console.log(`up:${name}`);
  });

  pro.on(`change:${name}`, (val) => {
    console.log(`change:${name}`, val);
  });
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant