Git Product home page Git Product logo

switchcontrollibrary's Introduction

Switch Control Library

概要

Arduino を Switch コントローラーとして認識させます。

v2 系 は v1 系とは互換性がありません。 過去バージョンはReleaseページよりダウンロードできます。

使い方

VID=0x0f0d, PID=0x0092 へ変更してボードへ書き込んでください。

変更方法はボードによって異なりますが、SparkFun Pro Micro の場合、下記ファイルを変更してください。 ~/Library/Arduino15/packages/SparkFun/hardware/avr/1.1.12/boards.txt

操作方法

  • ボタンを押す

    • pressButton(uint8_t button)

      SwitchControlLibrary().pressButton(Button::A); // Aボタンを押す
      SwitchControlLibrary().pressButton(Button::B); // Bボタンを押す
      
    • releaseButton(uint8_t button)

      SwitchControlLibrary().releaseButton(Button::A); // Aボタンを離す
      SwitchControlLibrary().releaseButton(Button::B); // Bボタンを離す
      
    • Button 定義一覧

      Button::Y
      Button::B
      Button::A
      Button::X
      Button::L
      Button::R
      Button::ZL
      Button::ZR
      Button::MINUS
      Button::PLUS
      Button::LCLICK
      Button::RCLICK
      Button::HOME
      Button::CAPTURE
      
  • ハット

    • moveHat(uint8_t hat)

      SwitchControlLibrary().moveHat(Hat::UP); // ハットは上
      SwitchControlLibrary().moveHat(Hat::RIGHT); // ハットは右
      
    • Hat 定義一覧

      Hat::UP
      Hat::UP_RIGHT
      Hat::RIGHT
      Hat::DOWN_RIGHT
      Hat::DOWN
      Hat::DOWN_LEFT
      Hat::LEFT
      Hat::UP_LEFT
      Hat::NEUTRAL
      
    • pressHat(uint8_t hat_button) releaseHat(uint8_t hat_button)

      SwitchControlLibrary().pressHat(HatButton::UP) // ハットは上
      SwitchControlLibrary().pressHat(HatButton::RIGHT) // ハットは右上
      SwitchControlLibrary().releaseHat(HatButton::UP) // ハットは右
      SwitchControlLibrary().releaseHat(HatButton::RIGHT) // ハットはニュートラル
      
    • HatButton 定義一覧

      HatButton::UP
      HatButton::RIGHT
      HatButton::DOWN
      HatButton::LEFT
      
  • スティック

    • moveLeftStick(uint8_t lx, uint8_t ly) moveRightStick(uint8_t rx, uint8_t ry)

      • lx ly rx ry には、0〜255 の値を指定します。
      SwitchControlLibrary().moveLeftStick(0, 128) // 左スティックは左
      SwitchControlLibrary().moveLeftStick(128, 128) // 左スティックはニュートラル
      SwitchControlLibrary().moveLeftStick(255, 128) // 左スティックは右
      SwitchControlLibrary().moveLeftStick(Stick::MIN, Stick::NEUTRAL) // 左スティックは左
      SwitchControlLibrary().moveLeftStick(Stick::MAX, Stick::NEUTRAL) // 左スティックは右
      
    • Stick 定義一覧

      Stick::MIN
      Stick::NEUTRAL
      Stick::MAX
      
  • sendReport()

    sendReport() を実行したタイミングでキーが送信されます。

    SwitchControlLibrary().pressButton(Button::A); // ニュートラル
    SwitchControlLibrary().pressButton(Button::B); // ニュートラル
    SwitchControlLibrary().sendReport() // A、Bボタンが同時に送信される
    

ライセンス

MIT

switchcontrollibrary's People

Contributors

celclow avatar ponderingm avatar

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.