Skip to content
Simple way to map a push-button to a keyboard key. This library utilize the ability of 32u4-based Arduino-compatible boards to emulate USB-keyboard.
C++
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples/fourButtons
src created src folder Mar 29, 2016
LICENSE
README.md
keywords.txt added keywords.txt Mar 29, 2016
library.json
library.properties version bump Mar 29, 2016

README.md

keyboardButton

This library will work only on 32u4-based boards (Arduino Leonardo or Micro, SparkFun Pro Micro, Adafruit Feather etc) and only on pins with external interrupt support.

On Micro, Leonardo and other 32u4-based boards there are 5 external interrupts available on pins 0, 1, 2, 3, 7.

Example

#include <KeyboardButton.h>

void setup() {
  Keyboard.begin();

  KeyboardButton::enableButton(0, KEY_UP_ARROW);
  KeyboardButton::enableButton(1, KEY_DOWN_ARROW);
  
  KeyboardButton::enableButton(3, 'a');
  KeyboardButton::enableButton(7, 'b');
}

void loop() {
  KeyboardButton::updateButtons();
}

Useful links

Tested with

  • Pro Micro
You can’t perform that action at this time.