/* Simple HID Keyboard Example
by: Jim Lindblom
SparkFun Electronics
date: 1/17/12
This example code is here to show basic usage of the
Keyboard.write(char) function. The ProMicro emulates a USB HID
Keyboard. When a button press is sensed it'll send a 'z' over
USB to a computer.
A momentary push button is connected to the Arduino. One side of
the button connected to pin 9 the other side connected to ground.
*/
int buttonPin = 9; // Set a button to any pin
void setup()
{
pinMode(buttonPin, INPUT); // Set the button as an input
digitalWrite(buttonPin, HIGH); // Pull the button high
}
void loop()
{
if (digitalRead(buttonPin) == 0) // if the button goes low
{
Keyboard.write('z'); // send a 'z' to the computer via Keyboard HID
delay(1000); // delay so there aren't a kajillion z's
}
}