Skip to content

Instantly share code, notes, and snippets.

@un4ckn0wl3z
Created April 28, 2016 11:40
Show Gist options
  • Save un4ckn0wl3z/dcd0af58d91637517e79b226d2b33454 to your computer and use it in GitHub Desktop.
Save un4ckn0wl3z/dcd0af58d91637517e79b226d2b33454 to your computer and use it in GitHub Desktop.
#define TEENSY3
#ifdef TEENSY2
#include<usb_private.h>
#endif
void setup()
{
delay(5000); //Delay required for OS to connect the device properly
Keyboard.set_modifier(MODIFIERKEY_RIGHT_GUI); //Tell Teensy to press Windows key
Keyboard.set_key1(KEY_R); //Tell Teensy to press R
Keyboard.send_now(); //Press "Windows key + R"
delay(500); //Wait for half second
Keyboard.set_modifier(0); //Tell Teensy to release Windows key
Keyboard.set_key1(0); //Tell Teensy to release R
Keyboard.send_now(); //Release "Windows key + R"
//Teensy should open a run prompt now
Keyboard.print("notepad"); //Type notepad in the run prompt
Keyboard.set_key1(KEY_ENTER); //Tell Teensy to press Enter key
Keyboard.send_now(); //Press Enter
Keyboard.set_key1(0); //Tell Teensy to release Enter
Keyboard.send_now(); //Release Enter
delay(2000); //Wait for notepad to open
Keyboard.print("Hello World "); //Type Hello World in notepad
delay(1000);
Keyboard.print("This is Msg From . ."); //Type Hello World in notepad
delay(1000);
Keyboard.print("Un4ckn0wl3z"); //Type Hello World in notepad
}
void loop()
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment