/* Keyboard Button test this code is a modified verson of the code written by Tom Igoe that can be found at: http://www.arduino.cc/en/Tutorial/KeyboardButton the code serial prints the desired string. When used with the windows and mac program AAC Keys, this program will type in the desired phrase or password wherever the PC cursor is. The circuit: * pushbutton attached from pin 2 to +5V * 10-kilohm resistor attached from pin 4 to ground */ const int buttonPin = 4; // input pin for pushbutton int previousButtonState = HIGH; // for checking the state of a pushButton int counter = 0; // button push counter void setup() { // make the pushButton pin an input: pinMode(buttonPin, INPUT); // initialize control over the keyboard: Serial.begin(9600); } void loop() { // read the pushbutton: String pass_1 = "type_your_password_here!"; //make sure you leave the quotes around the password! int buttonState = digitalRead(buttonPin); // if the button state has changed, if ((buttonState != previousButtonState) // and it's currently pressed: && (buttonState == HIGH)) { // increment the button counter counter++; // type out a message //Keyboard.print("You pressed the button "); //Keyboard.print(counter); //Keyboard.println(" times."); Serial.print(pass_1); } // save the current button state for comparison next time: previousButtonState = buttonState; }