Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/kshoji/pxt-bluetooth-gamepad

BLE HID Gamepad module for micro:bit
https://github.com/kshoji/pxt-bluetooth-gamepad

ble gamepad microbit pxt

Last synced: 3 months ago
JSON representation

BLE HID Gamepad module for micro:bit

Lists

README

        

# bluetooth-gamepad

This PXT package allows the micro:bit to act as a Gamepad peripheral.

## Usage

Place a ``||bluetooth start gamepad service||`` block in your program to enable Bluetooth LE Gamepad.
With this block, the `micro:bit` starts advertise BLE packets as a Gamepad peripheral.

```blocks
bluetooth.startGamepadService();
```

For example, hold left gamepad button :

```blocks
bluetooth.setGamepadButton(GamepadButton.GAMEPAD_BUTTON_LEFT, ButtonState.BUTTON_DOWN);
```

## About test script (test.ts)

The micro:bit's memory(RAM) size is too small to run the test script.
To build & run the test script(test.ts), edit `pxt.json` file, and activate `"yotta" : "config"` part of the configuration.

This hack makes `BLE GATT table` smaller, and removes unnecessary BLE services(DFU, Event, and Device Information Service).

## Supported Platforms

Currently, tested with `micro:bit` and `Android` host only.
Mac OS X can connect with `micro:bit`, but it can't receive Gamepad messages.

## Supported targets

* for PXT/microbit

(The metadata above is needed for package search.)

## License

MIT

```package
bluetooth
bluetooth-gamepad=github:kshoji/pxt-bluetooth-gamepad
```