Skip to content

Instantly share code, notes, and snippets.

@heuermh
Created November 8, 2012 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heuermh/4041593 to your computer and use it in GitHub Desktop.
Save heuermh/4041593 to your computer and use it in GitHub Desktop.
Teensyduino sketch for USB keyboard stomp pedal board
// stomp using usb keyboard
#include <Bounce.h>
// map buttons to key presses
String key0 = "0";
String key1 = "1";
String key2 = "2";
String key3 = "3";
String key4 = "4";
String key5 = "5";
Bounce button0 = Bounce(0, 10);
Bounce button1 = Bounce(1, 10);
Bounce button2 = Bounce(2, 10);
Bounce button3 = Bounce(3, 10);
Bounce button4 = Bounce(4, 10);
Bounce button5 = Bounce(5, 10);
void setup()
{
pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(11, OUTPUT);
}
void loop()
{
button0.update();
button1.update();
button2.update();
button3.update();
button4.update();
button5.update();
if (button0.fallingEdge())
{
Keyboard.print(key0);
}
if (button1.fallingEdge())
{
Keyboard.print(key1);
}
if (button2.fallingEdge())
{
Keyboard.print(key2);
}
if (button3.fallingEdge())
{
Keyboard.print(key3);
}
if (button4.fallingEdge())
{
Keyboard.print(key4);
}
if (button5.fallingEdge())
{
Keyboard.print(key5);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment