diff --git a/controller_without_comm/config.h b/controller_without_comm/config.h index fbcca7e..025e216 100644 --- a/controller_without_comm/config.h +++ b/controller_without_comm/config.h @@ -33,8 +33,8 @@ #define KEYBOARD_BUTTON_TUNE_RIGHT_0 '\'' #define KEYBOARD_BUTTON_SUB_LEFT_0 179 #define KEYBOARD_BUTTON_SUB_LEFT_1 176 -#define KEYBOARD_BUTTON_SUB_RIGHT_0 '1' -#define KEYBOARD_BUTTON_SUB_RIGHT_1 '2' +#define KEYBOARD_BUTTON_SUB_RIGHT_0 216 +#define KEYBOARD_BUTTON_SUB_RIGHT_1 215 #define KEYBOARD_BUTTON_DUPLICATED_UPARROW 218 #define KEYBOARD_BUTTON_DUPLICATED_DOWNARROW 217 diff --git a/controller_without_comm/controller_without_comm.ino b/controller_without_comm/controller_without_comm.ino index ef8902a..cfed1db 100644 --- a/controller_without_comm/controller_without_comm.ino +++ b/controller_without_comm/controller_without_comm.ino @@ -1,21 +1,6 @@ #include "config.h" #include -bool pressed_button_tune_left_0 = false; -bool pressed_button_tune_left_1 = false; -bool pressed_button_tune_left_2 = false; -bool pressed_button_tune_left_3 = false; -bool pressed_button_tune_left_side = false; -bool pressed_button_tune_right_side = false; -bool pressed_button_tune_right_3 = false; -bool pressed_button_tune_right_2 = false; -bool pressed_button_tune_right_1 = false; -bool pressed_button_tune_right_0 = false; -bool pressed_button_sub_left_0 = false; -bool pressed_button_sub_left_1 = false; -bool pressed_button_sub_right_0 = false; -bool pressed_button_sub_right_1 = false; - void setup() { pinMode(PIN_BUTTON_TUNE_LEFT_0, INPUT_PULLUP); pinMode(PIN_BUTTON_TUNE_LEFT_1, INPUT_PULLUP); @@ -34,171 +19,74 @@ void setup() { } void loop() { - if (!digitalRead(PIN_BUTTON_DUPLICATED_UPARROW)) { - Keyboard.write(KEYBOARD_BUTTON_DUPLICATED_UPARROW); - } - if (!digitalRead(PIN_BUTTON_DUPLICATED_DOWNARROW)) { - Keyboard.write(KEYBOARD_BUTTON_DUPLICATED_DOWNARROW); - } - if (!digitalRead(PIN_BUTTON_DUPLICATED_LEFTARROW)) { - Keyboard.write(KEYBOARD_BUTTON_DUPLICATED_LEFTARROW); - } - if (!digitalRead(PIN_BUTTON_DUPLICATED_RIGHTARROW)) { - Keyboard.write(KEYBOARD_BUTTON_DUPLICATED_RIGHTARROW); - } - if (!digitalRead(PIN_BUTTON_TUNE_LEFT_0)) { - if (!pressed_button_tune_left_0) { - pressed_button_tune_left_0 = true; - Keyboard.press(KEYBOARD_BUTTON_TUNE_LEFT_0); - } + Keyboard.press(KEYBOARD_BUTTON_TUNE_LEFT_0); } else { - if (pressed_button_tune_left_0) { - pressed_button_tune_left_0 = false; - Keyboard.release(KEYBOARD_BUTTON_TUNE_LEFT_0); - } + Keyboard.release(KEYBOARD_BUTTON_TUNE_LEFT_0); } if (!digitalRead(PIN_BUTTON_TUNE_LEFT_1)) { - if (!pressed_button_tune_left_1) { - pressed_button_tune_left_1 = true; - Keyboard.press(KEYBOARD_BUTTON_TUNE_LEFT_1); - } + Keyboard.press(KEYBOARD_BUTTON_TUNE_LEFT_1); } else { - if (pressed_button_tune_left_1) { - pressed_button_tune_left_1 = false; - Keyboard.release(KEYBOARD_BUTTON_TUNE_LEFT_1); - } + Keyboard.release(KEYBOARD_BUTTON_TUNE_LEFT_1); } if (!digitalRead(PIN_BUTTON_TUNE_LEFT_2)) { - if (!pressed_button_tune_left_2) { - pressed_button_tune_left_2 = true; - Keyboard.press(KEYBOARD_BUTTON_TUNE_LEFT_2); - } + Keyboard.press(KEYBOARD_BUTTON_TUNE_LEFT_2); } else { - if (pressed_button_tune_left_2) { - pressed_button_tune_left_2 = false; - Keyboard.release(KEYBOARD_BUTTON_TUNE_LEFT_2); - } + Keyboard.release(KEYBOARD_BUTTON_TUNE_LEFT_2); } if (!digitalRead(PIN_BUTTON_TUNE_LEFT_3)) { - if (!pressed_button_tune_left_3) { - pressed_button_tune_left_3 = true; - Keyboard.press(KEYBOARD_BUTTON_TUNE_LEFT_3); - } + Keyboard.press(KEYBOARD_BUTTON_TUNE_LEFT_3); } else { - if (pressed_button_tune_left_3) { - pressed_button_tune_left_3 = false; - Keyboard.release(KEYBOARD_BUTTON_TUNE_LEFT_3); - } + Keyboard.release(KEYBOARD_BUTTON_TUNE_LEFT_3); } if (!digitalRead(PIN_BUTTON_TUNE_LEFT_SIDE)) { - if (!pressed_button_tune_left_side) { - pressed_button_tune_left_side = true; - Keyboard.press(KEYBOARD_BUTTON_TUNE_LEFT_SIDE); - } + Keyboard.press(KEYBOARD_BUTTON_TUNE_LEFT_SIDE); } else { - if (pressed_button_tune_left_side) { - pressed_button_tune_left_side = false; - Keyboard.release(KEYBOARD_BUTTON_TUNE_LEFT_SIDE); - } + Keyboard.release(KEYBOARD_BUTTON_TUNE_LEFT_SIDE); } if (!digitalRead(PIN_BUTTON_TUNE_RIGHT_SIDE)) { - if (!pressed_button_tune_right_side) { - pressed_button_tune_right_side = true; - Keyboard.press(KEYBOARD_BUTTON_TUNE_RIGHT_SIDE); - } + Keyboard.press(KEYBOARD_BUTTON_TUNE_RIGHT_SIDE); } else { - if (pressed_button_tune_right_side) { - pressed_button_tune_right_side = false; - Keyboard.release(KEYBOARD_BUTTON_TUNE_RIGHT_SIDE); - } + Keyboard.release(KEYBOARD_BUTTON_TUNE_RIGHT_SIDE); } if (!digitalRead(PIN_BUTTON_TUNE_RIGHT_3)) { - if (!pressed_button_tune_right_3) { - pressed_button_tune_right_3 = true; - Keyboard.press(KEYBOARD_BUTTON_TUNE_RIGHT_3); - } + Keyboard.press(KEYBOARD_BUTTON_TUNE_RIGHT_3); } else { - if (pressed_button_tune_right_3) { - pressed_button_tune_right_3 = false; - Keyboard.release(KEYBOARD_BUTTON_TUNE_RIGHT_3); - } + Keyboard.release(KEYBOARD_BUTTON_TUNE_RIGHT_3); } if (!digitalRead(PIN_BUTTON_TUNE_RIGHT_2)) { - if (!pressed_button_tune_right_2) { - pressed_button_tune_right_2 = true; - Keyboard.press(KEYBOARD_BUTTON_TUNE_RIGHT_2); - } + Keyboard.press(KEYBOARD_BUTTON_TUNE_RIGHT_2); } else { - if (pressed_button_tune_right_2) { - pressed_button_tune_right_2 = false; - Keyboard.release(KEYBOARD_BUTTON_TUNE_RIGHT_2); - } + Keyboard.release(KEYBOARD_BUTTON_TUNE_RIGHT_2); } if (!digitalRead(PIN_BUTTON_TUNE_RIGHT_1)) { - if (!pressed_button_tune_right_1) { - pressed_button_tune_right_1 = true; - Keyboard.press(KEYBOARD_BUTTON_TUNE_RIGHT_1); - } + Keyboard.press(KEYBOARD_BUTTON_TUNE_RIGHT_1); } else { - if (pressed_button_tune_right_1) { - pressed_button_tune_right_1 = false; - Keyboard.release(KEYBOARD_BUTTON_TUNE_RIGHT_1); - } + Keyboard.release(KEYBOARD_BUTTON_TUNE_RIGHT_1); } if (!digitalRead(PIN_BUTTON_TUNE_RIGHT_0)) { - if (!pressed_button_tune_right_0) { - pressed_button_tune_right_0 = true; - Keyboard.press(KEYBOARD_BUTTON_TUNE_RIGHT_0); - } + Keyboard.press(KEYBOARD_BUTTON_TUNE_RIGHT_0); } else { - if (pressed_button_tune_right_0) { - pressed_button_tune_right_0 = false; - Keyboard.release(KEYBOARD_BUTTON_TUNE_RIGHT_0); - } + Keyboard.release(KEYBOARD_BUTTON_TUNE_RIGHT_0); } if (!digitalRead(PIN_BUTTON_SUB_LEFT_0)) { - if (!pressed_button_sub_left_0) { - pressed_button_sub_left_0 = true; - Keyboard.press(KEYBOARD_BUTTON_SUB_LEFT_0); - } + Keyboard.press(KEYBOARD_BUTTON_SUB_LEFT_0); } else { - if (pressed_button_sub_left_0) { - pressed_button_sub_left_0 = false; - Keyboard.release(KEYBOARD_BUTTON_SUB_LEFT_0); - } + Keyboard.release(KEYBOARD_BUTTON_SUB_LEFT_0); } if (!digitalRead(PIN_BUTTON_SUB_LEFT_1)) { - if (!pressed_button_sub_left_1) { - pressed_button_sub_left_1 = true; - Keyboard.press(KEYBOARD_BUTTON_SUB_LEFT_1); - } + Keyboard.press(KEYBOARD_BUTTON_SUB_LEFT_1); } else { - if (pressed_button_sub_left_1) { - pressed_button_sub_left_1 = false; - Keyboard.release(KEYBOARD_BUTTON_SUB_LEFT_1); - } + Keyboard.release(KEYBOARD_BUTTON_SUB_LEFT_1); } if (!digitalRead(PIN_BUTTON_SUB_RIGHT_0)) { - if (!pressed_button_sub_right_0) { - pressed_button_sub_right_0 = true; - Keyboard.press(KEYBOARD_BUTTON_SUB_RIGHT_0); - } + Keyboard.press(KEYBOARD_BUTTON_SUB_RIGHT_0); } else { - if (pressed_button_sub_right_0) { - pressed_button_sub_right_0 = false; - Keyboard.release(KEYBOARD_BUTTON_SUB_RIGHT_0); - } + Keyboard.release(KEYBOARD_BUTTON_SUB_RIGHT_0); } if (!digitalRead(PIN_BUTTON_SUB_RIGHT_1)) { - if (!pressed_button_sub_right_1) { - pressed_button_sub_right_1 = true; - Keyboard.press(KEYBOARD_BUTTON_SUB_RIGHT_1); - } + Keyboard.press(KEYBOARD_BUTTON_SUB_RIGHT_1); } else { - if (pressed_button_sub_right_1) { - pressed_button_sub_right_1 = false; - Keyboard.release(KEYBOARD_BUTTON_SUB_RIGHT_1); - } + Keyboard.release(KEYBOARD_BUTTON_SUB_RIGHT_1); } }