Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. #include "Keyboard.h"
  2.  
  3. void typeKey(int key)
  4. {
  5. Keyboard.press(key);
  6. delay(50);
  7. Keyboard.release(key);
  8. }
  9.  
  10. /* Init function */
  11. void setup()
  12. {
  13. pinMode(3, INPUT_PULLUP);
  14. if (digitalRead(3) == LOW){
  15. while(1);
  16. }
  17. // Begining the Keyboard stream
  18. Keyboard.begin();
  19.  
  20. // Wait 500ms
  21. delay(500);
  22.  
  23. delay(2000);
  24.  
  25. Keyboard.press(KEY_LEFT_GUI);
  26. Keyboard.press('r');
  27. Keyboard.releaseAll();
  28.  
  29. delay(200);
  30.  
  31.  
  32. typeKey(KEY_RETURN);
  33.  
  34. Keyboard.print("cmd");
  35. delay(50);
  36. typeKey(KEY_RETURN);
  37. delay(500);
  38.  
  39. Keyboard.print("cd Desktop");
  40. typeKey(KEY_RETURN);
  41. delay(100);
  42.  
  43. Keyboard.print("echo \"Testing special characters: dollar $ exclamation ! percentage % less < greater > pipe | carrot ^ semicolon ; dot . comma , question mark ? parentheses () square brackets [] brackets {} backwards slash \\ slash / alternative way for pipe: ");
  44. delay(50);
  45. Keyboard.press(KEY_LEFT_ALT);
  46. Keyboard.write(0xE1);
  47. Keyboard.write(0xE2);
  48. Keyboard.write(0xE4);
  49. Keyboard.release(KEY_LEFT_ALT);
  50. Keyboard.print("\" > test.txt");
  51. delay(50);
  52. typeKey(KEY_RETURN);
  53.  
  54. Keyboard.print("exit");
  55. delay(20);
  56. typeKey(KEY_RETURN);
  57.  
  58.  
  59. // Ending stream
  60. Keyboard.end();
  61. }
  62.  
  63. /* Unused endless loop */
  64. void loop() {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement