Skip to content

Instantly share code, notes, and snippets.

@mrrcollins
Last active January 5, 2016 16:45
Show Gist options
  • Save mrrcollins/d7ecb12d2563e7a13ba8 to your computer and use it in GitHub Desktop.
Save mrrcollins/d7ecb12d2563e7a13ba8 to your computer and use it in GitHub Desktop.
#include <Keyboard.h>
int sensorPin = 10;
void setup()
{
pinMode(sensorPin, INPUT);
Serial.begin(9600);
Keyboard.begin();
}
void sendWakeUp(void);
void loop()
{
if (digitalRead(sensorPin) == 1)
{
sendWakeUp();
while (digitalRead(sensorPin) == 1)
{
delay(1);
}
}
delay(1000);
}
void sendWakeUp(void)
{
Keyboard.press('a');
delay(1);
Keyboard.release('a');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment