Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Keyboard.h"
- void typeKey(int key)
- {
- Keyboard.press(key);
- delay(50);
- Keyboard.release(key);
- }
- /* Init function */
- void setup()
- {
- pinMode(3, INPUT_PULLUP);
- if (digitalRead(3) == LOW){
- while(1);
- }
- // Begining the Keyboard stream
- Keyboard.begin();
- // Wait 500ms
- delay(500);
- delay(2000);
- Keyboard.press(KEY_LEFT_GUI);
- Keyboard.press('r');
- Keyboard.releaseAll();
- delay(200);
- typeKey(KEY_RETURN);
- Keyboard.print("cmd");
- delay(50);
- typeKey(KEY_RETURN);
- delay(500);
- Keyboard.print("cd Desktop");
- typeKey(KEY_RETURN);
- delay(100);
- 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: ");
- delay(50);
- Keyboard.press(KEY_LEFT_ALT);
- Keyboard.write(0xE1);
- Keyboard.write(0xE2);
- Keyboard.write(0xE4);
- Keyboard.release(KEY_LEFT_ALT);
- Keyboard.print("\" > test.txt");
- delay(50);
- typeKey(KEY_RETURN);
- Keyboard.print("exit");
- delay(20);
- typeKey(KEY_RETURN);
- // Ending stream
- Keyboard.end();
- }
- /* Unused endless loop */
- void loop() {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement