Home ArduinoRubber Duck Arduino rubber duck example – hello world

Arduino rubber duck example – hello world

Requirements

Arduino Leonardo, Micro Pro, Teensy 3.0 or later. Any micro that you can simulate a keyboard basically

 

Rubber Duck Script

[codesyntax lang=”dos”]

DELAY 3000
GUI r
DELAY 500
STRING notepad
DELAY 500
ENTER
DELAY 750
STRING Hello World!!!
ENTER

[/codesyntax]

To convert this to Arduino code visit https://thehacktoday.com/ducky/, paste the code above and then click compile. You then get the Arduino code in the right hand side which can be pasted into the IDE

Arduino Code

Here is the script above converted to Arduino code

[codesyntax lang=”cpp”]

/*
 * Generated with <3 by Dckuino.js, an open source project !
 */

#include "Keyboard.h"

void typeKey(uint8_t key)
{
  Keyboard.press(key);
  delay(50);
  Keyboard.release(key);
}

/* Init function */
void setup()
{
  // Begining the Keyboard stream
  Keyboard.begin();

  // Wait 500ms
  delay(500);

  delay(3000);

  Keyboard.press(KEY_LEFT_GUI);
  Keyboard.press('r');
  Keyboard.releaseAll();

  delay(500);

  Keyboard.print("notepad");

  delay(500);

  typeKey(KEY_RETURN);

  delay(750);

  Keyboard.print("Hello World!!!");

  typeKey(KEY_RETURN);

  // Ending stream
  Keyboard.end();
}

/* Unused endless loop */
void loop() {}

[/codesyntax]

You may also like