Use Nano 2 as HID device


#1

Hi there,

I want to use the Nano 2 as a HID device. I want to connect some push buttons to the device. I want to connect my Laptop to the device and I want to control my computer with the buttons.

What is a fast way to get this done?
I am new to RedBear Devices but I played around with the Nordic nrf52-Devboard.

So, I could use the Arduino Software, but I didn’t found a HID Profil / Library.
Or I use the nordic sdk. I already flashed the hex-file I found under 'examples/ble_peripheral/ble_app_hids_keyboard/hex/ble_app_hids_keyboard_pca10040_s132.hex on the device. And it seems to work.
But all the Board description files are for the nordic dev boards. How do I start a RedBear Project?

Best, Lino


#2

Hi @lino,

Have you install the Arduino board package for the Nano 2?

While if you playing with Nano 2 using Arduino IDE, we don’t provide any BLE service yet. User has to add BLE services manually in Arduino sketch. You can try the built-in BLE peripheral examples after you installing the board package, to see how to add BLE services.

Then you have to migrate the HID service from the Nordic SDK to Arduino.

Best regards,
Guohui


#3

I used the Nordik SDK and it wasn’t so hard.

The example “ble_app_hids_keyboard” does everything I need. I just made some small change in the main file.
I also created a new board.h file, which following lines:

// ...
#define LEDS_NUMBER    1

#define LED_START      11
#define LED_1          11
#define LED_STOP       11

#define LEDS_ACTIVE_STATE 0

#define LEDS_INV_MASK  LEDS_MASK

#define LEDS_LIST { LED_1 }

#define BSP_LED_0      LED_1

#define BUTTONS_NUMBER 4

#define BUTTON_START   4
#define BUTTON_1       4
#define BUTTON_2       5
#define BUTTON_3       6
#define BUTTON_4       7
#define BUTTON_STOP    7
#define BUTTON_PULL    NRF_GPIO_PIN_PULLUP

// ...