├── TheButton.ino └── README /TheButton.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * TheButton.ino 3 | * 4 | * It emulates a space bar, and you can't do it faster than once per half second. 5 | * 6 | * pin 10 is for the button. pin 11 is the LED. The LED turns on when you push the button. 7 | * 8 | */ 9 | 10 | void setup() { 11 | Serial.begin(9600); 12 | pinMode(10, INPUT_PULLUP); 13 | pinMode(11, OUTPUT); 14 | delay(3000); // wait 3 seconds 15 | } 16 | 17 | void loop() { 18 | if (digitalRead(10) == HIGH) { 19 | delay(10); 20 | } else { 21 | Keyboard.print(" "); // we print a space 22 | digitalWrite(11, HIGH); // set the LED on 23 | delay(500); 24 | digitalWrite(11, LOW); // set the LED off 25 | } 26 | delay(10); 27 | } 28 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | 2 | Teensy code for The Button. 3 | 4 | What is "The Button" exactly? See here: 5 | 6 | http://rasterweb.net/raster/2011/05/09/the-button/ 7 | 8 | You'll need to install the Arduino IDE and the Teensduino add-on. 9 | 10 | http://arduino.cc/hu/Main/Software 11 | 12 | http://www.pjrc.com/teensy/teensyduino.html 13 | 14 | The code allows the Teensy to emulate a space bar when the button 15 | is pressed, and you can't do it faster than once per half second. 16 | 17 | In the code, pin 10 is for the button and pin 11 is for the LED. 18 | 19 | The on-board LED turns on when you push the button. It's for debugging 20 | more than anything else, but you could wire up an external LED to light 21 | up if you were so inclined. 22 | 23 | 24 | This code is released under the GPL. 25 | 26 | Pete Prodoehl 27 | pete@rasterweb.net 28 | http://rasterweb.net/raster/ 29 | Twitter: @raster 30 | 31 | --------------------------------------------------------------------------------