Advertisement
alexanderik

keyboardtest

Jun 25th, 2021
1,594
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Arduino.h>
  2. #include "DigiKeyboard.h"
  3.  
  4. void setup() {
  5.   // don't need to set anything up to use DigiKeyboard
  6. }
  7.  
  8. void loop() {
  9.   // this is generally not necessary but with some older systems it seems to
  10.   // prevent missing the first character after a delay:
  11.   DigiKeyboard.sendKeyStroke(0);
  12.  
  13.   // Type out this string letter by letter on the computer (assumes US-style
  14.   // keyboard)
  15.  
  16.   DigiKeyboard.update();
  17.   DigiKeyboard.sendKeyStroke(MOD_CONTROL_LEFT);
  18.   DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT);
  19.   //DigiKeyboard.sendKeyStroke(KEY_LEFT_CTRL, KEY_A);
  20.   DigiKeyboard.sendKeyStroke(KEY_BACKSPACE);
  21.   DigiKeyboard.print("notepad.exe");
  22.   DigiKeyboard.delay(2000);
  23.   DigiKeyboard.sendKeyStroke(KEY_ENTER);
  24.   DigiKeyboard.delay(2500);
  25.   DigiKeyboard.println("Hello World");
  26.   DigiKeyboard.delay(200);
  27.   DigiKeyboard.print("\t");
  28.   DigiKeyboard.delay(200);
  29.   DigiKeyboard.print("\t");
  30.   DigiKeyboard.print("Lunch is on me!");
  31.   DigiKeyboard.delay(200);
  32.   DigiKeyboard.print("\t");
  33.   DigiKeyboard.println("I'm feeling generous so I'll be buying everyone lunch for a week.");
  34.   DigiKeyboard.println("Daniel go Sleep..");
  35.   DigiKeyboard.delay(200);
  36.   DigiKeyboard.sendKeyStroke(KEY_ENTER);
  37.   DigiKeyboard.delay(5000);
  38.   DigiKeyboard.sendKeyStroke(0);
  39.   DigiKeyboard.sendKeyStroke(KEY_L, MOD_GUI_LEFT);
  40.  
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement