2

I'm planning on making my own Bluetooth mechanical keyboard using the Adafruit Feather 32u4 Bluetooth LE. Something that I haven't really figured out is the programming side of things. I was wondering if there is an easy to use library for this.

I know of the KeyPad library but I'm not sure how to handle modifier keys like Shift and CTRL with it. Any idea can help!

Edit: Like said before the project I'm working on is a Bluetooth mechanical keyboard. So this means there will be 85 (at least for my design) switches in a matrix.

In an ideal world the library I'm looking for can do the following: I specify the keys and their position in a matrix and what the modifier keys are. It can generate the appropriate ASCII character when the matching key(s) are pressed and return it or something, so that I can send it over Bluetooth in another piece of code.

In a less ideal world I use the KeyPad library but I don't really know how to take care of modifier keys like shift when doing that.

Have a nice day!

7
  • What exactly the library should do? Your whole project?
    – Thomas S.
    Commented Mar 28, 2016 at 14:54
  • @ThomasS. My project is a Bluetooth Mechanical Keyboard. I'm sorry for the fuzzy explanation, I updated the question. I hope its a bit better!
    – JanG
    Commented Mar 28, 2016 at 15:12
  • What is the problem of accessing a matrix, checking for keys (pressed and typed) and converting to the appropriate character/byte sequence? I don't see how a library would help here much because of the massive configuration. The only tiny problem you need to solve is that pressing multiple keys should be allowed by the circuit (e.g. using diodes in the rows or columns or, if you want to be perfect, for each key).
    – Thomas S.
    Commented Mar 28, 2016 at 17:01
  • That's how I'm going to do it now. I just remembered coming a cross a library for making an USB keyboard that handled everything by itself. I thought I would need to handle lower- and uppercase letters in the code but it turns out you don't need to do that, you send a MODIFIERKEY_SHIFT command.
    – JanG
    Commented Mar 28, 2016 at 17:32
  • I do not have experience with the Bluetooth version of it, but at least with "normal" Arduinos, I found out that only the UNO could produce the correct sequences to enter BIOS configuration mode. This is due to the fact that the BIOS has very specific expectations. The UNO employs a secondary AVR chip to emulate the USB keyboard and it happens to be compliant with the BIOS expectations. Other Arduinos (nano, due, etc.) that rely on a sw library are not compliant. So you might want to check if you can enter BIOS config mode, before ditching other keyboards. Commented Mar 28, 2016 at 18:08

2 Answers 2

1

For shift (making an a into an A), simply program in some ands. Pseudo-code:

if shift AND a:
    return A
elif shift AND b:
    return B

and so on and so forth.

1
  • 3
    Nope. Look at the ASCII table, you can use shift to decrease the ASCII value with 22, so you don't have to program it for every single combo
    – aaa
    Commented Sep 26, 2016 at 6:26
0

https://github.com/tmk/tmk_keyboard is what you want.

Search in Adafruit's site for how to incorporate Bluefruit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.