macro-keyboard/code/macro_keyboard/macro_keyboard_mapping3.ino
2023-07-27 22:19:52 +02:00

173 lines
6.9 KiB
C++

// Empty
void keyboard_Mode3() {
if (key) {
switch (key) {
case KEYBOARD_KEY1: //macro example!!! Windows1_Key+R = Run then type "mspaint" and press enter. Opens MS Paint
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press('r'); delay(0);
Keyboard.release(KEY_LEFT_GUI);
Keyboard.release('r');
delay(0); //give your system time to catch up with these android-speed keyboard presses
Keyboard.println("mspaint");
break;
case KEYBOARD_KEY2:
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press(KEY_LEFT_ARROW); delay(0); //snaps window to left side of screen.
break;
case KEYBOARD_KEY3:
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press(KEY_RIGHT_ARROW); delay(0); //snaps window to right side of screen.
break;
case KEYBOARD_KEY4:
for (int i = 0; i <= (KEYBOARD_ROWS * KEYBOARD_COLS); i++) {
pixels.setPixelColor(i, pixels.Color(127, 0, 0));
pixels.show();
delay(25);
}
delay(100);
for (int i = (KEYBOARD_ROWS * KEYBOARD_COLS); i >= 0; i--) {
pixels.setPixelColor(i, pixels.Color( 0, 127, 0));
pixels.show();
delay(25);
}
delay(100);
for (int i = 0; i <= (KEYBOARD_ROWS * KEYBOARD_COLS); i++) {
pixels.setPixelColor(i, pixels.Color( 0, 0, 127));
pixels.show();
delay(25);
}
delay(100);
for (int i = (KEYBOARD_ROWS * KEYBOARD_COLS); i >= 0; i--) {
pixels.setPixelColor(i, pixels.Color( 0, 0, 0));
pixels.show();
delay(25);
}
delay(100);
colorUpdate = 1;
break;
case KEYBOARD_KEY5: //macro example: Windows_Key+R = Run then type "calc" and press enter. Opens MS Calculator
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press('r'); delay(0);
Keyboard.release(KEY_LEFT_GUI);
Keyboard.release('r');
delay(0); //give your system time to catch up with these android-speed keyboard presses
Keyboard.println("calc");
break;
case KEYBOARD_KEY6: //macro example: Windows_Key+R = Run then type "excel" and press enter. Opens MS Excel
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press('r'); delay(0);
Keyboard.release(KEY_LEFT_GUI);
Keyboard.release('r');
delay(0); //give your system time to catch up with these android-speed keyboard presses
Keyboard.println("excel");
break; Keyboard.press(KEY_LEFT_CTRL);
case KEYBOARD_KEY7: //macro example: Windows_Key+R = Run then type "winword" and press enter. Opens MS Word
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press('r'); delay(0);
Keyboard.release(KEY_LEFT_GUI);
Keyboard.release('r');
delay(0); //give your system time to catch up with these android-speed keyboard presses
Keyboard.println("winword");
break;
case KEYBOARD_KEY8: //macro that opens chrome and a random wiki page for learning.
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press('r');
Keyboard.release(KEY_LEFT_GUI);
Keyboard.release('r');
delay(50); //give your system time to catch up with these android-speed keyboard presses
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.print('a');
Keyboard.println("chrome"); delay(500);
Keyboard.println("https://en.wikipedia.org/wiki/Special:Random");
break;
case KEYBOARD_KEY9: //macro that opens Chrome & Rick Rolls you like a chump
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press('r');
Keyboard.release(KEY_LEFT_GUI);
Keyboard.release('r');
delay(50); //give your system time to catch up with these android-speed keyboard presses
Keyboard.println("chrome"); delay(500);
Keyboard.println("https://www.yout1ube.com/watch?v=dQw4w9WgXcQ");
break;
case KEYBOARD_KEYA: //macro that opens Chrome and goes to my youtube channel!
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press('r');
Keyboard.release(KEY_LEFT_GUI);
Keyboard.release('r');
delay(50); //give your system time to catch up with these android-speed keyboard presses
Keyboard.println("chrome"); delay(500);
Keyboard.println("https://www.youtube.com/c/ryanbatesrbg");
break;
case KEYBOARD_KEYB: //minimize all windows (view desktop)
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press('m');
break;
case KEYBOARD_KEYC:
Keyboard.press(KEY_LEFT_GUI); //Opens Snip-it
Keyboard.release(KEY_LEFT_GUI); delay(25);
Keyboard.println("snip"); //type "snip" and press "return"
break;
}
delay(100);
Keyboard.releaseAll(); // this releases the buttons
}
} // neoPixels have been updated.
// Set the flag to 1; so they are not updated until a Mode change
void colors_Mode3() {
if (colorUpdate == 1) {
pixels.setPixelColor(KEYBOARD_KEY0, pixels.Color( 7, 0, 0)); // red
pixels.setPixelColor(KEYBOARD_KEY1, pixels.Color( 0, 0, 0)); // off
pixels.setPixelColor(KEYBOARD_KEY2, pixels.Color( 0, 0, 0)); // off
pixels.setPixelColor(KEYBOARD_KEY3, pixels.Color( 0, 0, 0)); // off
pixels.setPixelColor(KEYBOARD_KEY4, pixels.Color( 0, 0, 0)); // off
pixels.setPixelColor(KEYBOARD_KEY5, pixels.Color( 0, 0, 0)); // off
pixels.setPixelColor(KEYBOARD_KEY6, pixels.Color( 0, 0, 0)); // off
pixels.setPixelColor(KEYBOARD_KEY7, pixels.Color( 0, 0, 0)); // off
pixels.setPixelColor(KEYBOARD_KEY8, pixels.Color( 0, 0, 0)); // off
pixels.setPixelColor(KEYBOARD_KEY9, pixels.Color( 0, 0, 0)); // off
pixels.setPixelColor(KEYBOARD_KEYA, pixels.Color( 0, 0, 0)); // off
pixels.setPixelColor(KEYBOARD_KEYB, pixels.Color( 0, 0, 0)); // off
pixels.setPixelColor(KEYBOARD_KEYC, pixels.Color( 0, 0, 0)); // off
pixels.show();
colorUpdate = 0;
}
}
void encoderA_Mode3(){
long newPos = RotaryEncoderA.read()/ROTARY_SENSITIVITY;
if (newPos != positionEncoderA && newPos < positionEncoderA) {
positionEncoderA = newPos;
Consumer.write(MEDIA_VOLUME_UP);
}
if (newPos != positionEncoderA && newPos > positionEncoderA) {
positionEncoderA = newPos;
Consumer.write(MEDIA_VOLUME_DOWN);
}
}
void encoderB_Mode3(){
long newPos = RotaryEncoderB.read()/ROTARY_SENSITIVITY;
if (newPos != positionEncoderB && newPos < positionEncoderB) {
positionEncoderB = newPos;
Keyboard.press(KEY_RIGHT_CTRL);
Mouse.move(0, 0, 1);
Keyboard.release(KEY_RIGHT_CTRL);
}
if (newPos != positionEncoderB && newPos > positionEncoderB) {
positionEncoderB = newPos;
Keyboard.press(KEY_RIGHT_CTRL);
Mouse.move(0, 0, -1);
Keyboard.release(KEY_RIGHT_CTRL);
}
}
void display_Mode3() {
}