Hi everyone!
im building a usb box with 2x buttons and Sparkfun Micro Pro. One button sends SPACE bar to computer, and other button sends ESC.
i coppied the code from Sparkfun Website but the code as one key code written only…
can anyone help write the code to include the 2 buttons? maybe we could write it to use pin 10 for key ESC.
the code im using is:
#include <Keyboard.h>
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(’ '); // send a ’ ’ to the computer via Keyboard HID
delay(1000); // delay so there aren’t a kajillion z’s
}
}
As you already noticed i have no clue how this language work
Any help is highly appreciated!
Thanks!