# Nexus Game Controller

A game controller using a Seeed Studio XIAO nRF52840 Sense board that emulates a Bluetooth keyboard.

## Hardware
- 1 pcs [Seeed Studio XIAO nRF52840 Sense](https://www.seeedstudio.com/Seeed-XIAO-BLE-Sense-nRF52840-p-5253.html) ![XIAO nRF52840 Sense](XIAO_nRF52840_Sense.png)

- 9 pcs [push buttons](https://rpishop.cz/komponenty/6128-pimoroni-cerne-arkadove-tlacitko.html) connected to pins D1-D6 and D8-D10. ![Push_buttons](Push_buttons.png)

- 3 pcs [cables with Jack 3,5mm mono](https://www.kabel.sk/kabel-3-5mm-mono-m-m-1-5m-cierny-p21091) ![Cable_with_jack](Cable_with_jack.png)

## Features
- **Bluetooth LE Keyboard:** Connects to any computer or mobile device as a standard keyboard.
- **Multi-Event Buttons:** Each of the 9 buttons supports three types of interactions:
    - Single Click
    - Double Click
    - Long Press
- **Character Mapping:** Each button event sends a unique character.
- **Serial Debugging:** Outputs button events and Bluetooth connection status to the serial monitor.

## Button Mappings

| Button | Single Click | Double Click | Long Press |
|--------|--------------|--------------|------------|
| D1     | `a`          | `b`          | `c`        |
| D2     | `d`          | `e`          | `f`        |
| D3     | `g`          | `h`          | `i`        |
| D4     | `j`          | `k`          | `l`        |
| D5     | `m`          | `n`          | `o`        |
| D6     | `p`          | `q`          | `r`        |
| D8     | `s`          | `t`          | `u`        |
| D9     | `v`          | `w`          | `x`        |
| D10    | `y`          | `z`          | `1`        |

## How to Use

1.  **Setup Arduino IDE:**
    - Install the "Seeed nRF52 Boards" package.
    - Select "Seeed XIAO BLE Sense - nRF52840" as the board.
    - Install the "Adafruit Bluefruit nRF52" library.
2.  **Upload:** Compile and upload the [sketch](sketch.ino) to your XIAO board.
3.  **Connect:** Scan for Bluetooth devices on your computer or mobile device and connect to "Nexus Game Controller".
4.  **Play:** Press the buttons to send keystrokes. Open the Serial Monitor at 115200 baud to see debug information.

## 3D Print

![Hexagon](Krabicka_hexagon.png)

You can import the [3mf file](Krabicka_hexagon.3mf) to your slicer for printing.

## Customize your design

Open the [3D model](Krabicka_hexagon.FCStd) in FreeCAD to model your changes.

## Final Product

![Hexagon](Krabicka_hexagon_final.gif)
