Arduino Micro shortcut generator
thingiverse
Here is the rewritten text: Inspired by http://petapixel.com/2016/06/13/brushknob-puts-knob-button-fingertips-photoshop/ He uses an Atmel ATtiny85 with an encoder to make it a bit of a pain, but my version features an Arduino Micro (a crucial choice, since only single-processor Arduinos can simulate HID devices) and a PS2 joystick. His idea only lets you change brush size by turning the knob and switching between brush and eraser tools, but my version allows you to change brush size (y-axis), rotate between six frequently used tools (which I've customized, but can be changed in Arduino IDE), and press the joystick to send the most useful shortcut: Ctrl + 0. Or you can use it as an Arduino Micro holder ------------------- UPDATE ------------------- After using the device for a few days, I found it more useful than I thought, so I eventually needed another one. To avoid building a second one, I added a switch, which allows me to change its behavior. I also added room for the switch itself and a cap. Even if you don't need the extra space for the switch, I recommend printing the v2 version because it has a better grip, especially if your hands are as big as mine. Arduino Code #include "Keyboard.h" #define KEY_LEFT_GUI 0x83 int herramientas[6] = {'z', 'v', 'm', 'c', 'j', 'e'}; int ind_herr = 0; int retardo = 400; int buttonPin = 14; void setup() { pinMode(buttonPin, INPUT); digitalWrite(buttonPin, HIGH); } void loop() { int leex = analogRead(0); int leey = analogRead(2); if (digitalRead(buttonPin) == 0) { Keyboard.press(KEY_LEFT_GUI); Keyboard.write('0'); Keyboard.release(KEY_LEFT_GUI); delay(retardo); } // --------------------------------------------------- if (leex < 300) { herramienta_dcha(); } if (leex > 600) { herramienta_izda(); } // --------------------------------------------------- if (leey < 300) { Keyboard.write('.'); delay(retardo / 4); } if (leey > 600) { Keyboard.write(','); delay(retardo / 4); } } void herramienta_izda() { ind_herr--; if (ind_herr < 0) { ind_herr = 5; } Keyboard.write(herramientas[ind_herr]); delay(retardo); } void herramienta_dcha() { ind_herr++; if (ind_herr > 5) { ind_herr = 0; } Keyboard.write(herramientas[ind_herr]); delay(retardo); } (So don't forget to add the # in front of the define and the include) Special keys definitions #define KEY_LEFT_CTRL 0x80 #define KEY_LEFT_SHIFT 0x81 #define KEY_LEFT_ALT 0x82 #define KEY_LEFT_GUI 0x83 #define KEY_RIGHT_CTRL 0x84 #define KEY_RIGHT_SHIFT 0x85 #define KEY_RIGHT_ALT 0x86 #define KEY_RIGHT_GUI 0x87 #define KEY_UP_ARROW 0xDA #define KEY_DOWN_ARROW 0xD9 #define KEY_LEFT_ARROW 0xD4 #define KEY_RIGHT_ARROW 0xD8 #define KEY_HOME 0xC7 #define KEY_END 0xC6 #define KEY_PAGE_UP 0xD3 #define KEY_PAGE_DOWN 0xD6 #define KEY_CAPS_LOCK 0xC1 #define KEY_F1 0xB0 #define KEY_F2 0xA1 #define KEY_F3 0x9E #define KEY_F4 0x8D #define KEY_F5 0x86 #define KEY_F6 0x8F #define KEY_F7 0x90 #define KEY_F8 0x92 #define KEY_F9 0x93 #define KEY_F10 0xB3 #define KEY_F11 0xB2 #define KEY_F12 0xAE Notes We create the "herramientas" array with the tools we want to use, which are sent using the x-axis. ind_herr is a pointer that wraps around when it reaches the end of the array, making rotation continuous. To send special keys in shortcuts, you need to define the special key, like KEY_LEFT_GUI as 0x83 (the left cmd key on a Mac). I'll add a defines table later. As you can see, it's quite straightforward: press special key, send char, release special key.
With this file you will be able to print Arduino Micro shortcut generator with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on Arduino Micro shortcut generator.