Last active
January 21, 2020 13:50
-
-
Save santaklouse/ac1aa5eab6e64421af02ba52e11af706 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "DigiKeyboard.h" | |
| /* | |
| You can also change vendor of device =) | |
| path ~/Library/Arduino15/packages/digistump/hardware/avr/1.6.7/libraries/DigisparkKeyboard/usbconfig.h | |
| Below there are values for Apple Keyboard | |
| #define USB_CFG_VENDOR_ID 0xac, 0x05 | |
| #define USB_CFG_DEVICE_ID 0x02, 0x02 | |
| #define USB_CFG_VENDOR_NAME 'A','p','p','l','e',' ','I','n','c','.' | |
| #define USB_CFG_VENDOR_NAME_LEN 10 | |
| #define USB_CFG_DEVICE_NAME 'K','e','y','b','o','a','r','d' | |
| #define USB_CFG_DEVICE_NAME_LEN 8 | |
| */ | |
| /* | |
| silent activity emulator (without key-bases side effects) | |
| */ | |
| #define LEFT_CTRL 0xe0 | |
| //use led as activity indicator | |
| #define LED_PIN 1 | |
| void setup() { | |
| pinMode(LED_PIN, OUTPUT); | |
| randomSeed(analogRead(0)); | |
| digitalWrite(LED_PIN, LOW); | |
| } | |
| void loop() { | |
| //turn light on | |
| digitalWrite(LED_PIN, HIGH); | |
| //use magic Ctrl's combination in order to avoid side-effects | |
| DigiKeyboard.sendKeyStroke(LEFT_CTRL, MOD_CONTROL_LEFT); | |
| DigiKeyboard.delay(100); | |
| //turn light off | |
| digitalWrite(LED_PIN, LOW); | |
| //random delay between 5s and 20s | |
| DigiKeyboard.delay(random(5110, 20201)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment