/* XIAO USB Keyboard.example. http://yuichitamiya.fabcloud.io/fab16/How_to/program/ Google map help https://support.google.com/maps/answer/6396990?co=GENIE.Platform%3DDesktop&hl=ja Ctrl+/ to show help menu */ // https://github.com/cyborg5/TinyUSB_Mouse_and_Keyboard #include //HID KEYCODE //https://www.arduino.cc/reference/en/language/functions/usb/keyboard/keyboardmodifiers/ //uint8_t pins[] = { A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 }; //A9:no-use,A10:JACK_L uint8_t pins[] = { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 10}; //9:no-use, 10:JACK_L uint8_t pincount = sizeof(pins)/sizeof(pins[0]); /* Board 2 |8|4|3| |6|<|>| |5|0|1| |7|x|2| */ uint8_t Key0; uint8_t Key1; uint8_t Key2; uint8_t Key3; uint8_t Key4; uint8_t Key5; uint8_t Key6; uint8_t Key7; uint8_t Key8; uint8_t Key10; void setup() { Keyboard.begin(); // led pin pinMode(LED_BUILTIN, OUTPUT); digitalWrite(LED_BUILTIN, HIGH); // Set up pin as input for (uint8_t i=0; i Keyboard.press(KEY_LEFT_ARROW); delay(400); Keyboard.releaseAll(); digitalWrite(LED_BUILTIN, LOW); KeyRelease(); } void Key2_act() { // down arrow Keyboard.press(KEY_DOWN_ARROW); Keyboard.releaseAll(); digitalWrite(LED_BUILTIN, LOW); KeyRelease(); } void Key3_act() { // up arrow Keyboard.press(KEY_UP_ARROW); //delay(500); Keyboard.releaseAll(); digitalWrite(LED_BUILTIN, LOW); KeyRelease(); } void Key4_act() { // move to right tab Keyboard.press(KEY_LEFT_GUI); Keyboard.press(KEY_RIGHT_ALT); Keyboard.press(KEY_RIGHT_ARROW); Keyboard.releaseAll(); digitalWrite(LED_BUILTIN, LOW); KeyRelease(); } /* Board 2 |8|4|3| |6|<|>| |5|0|1| |7|x|2| */ void Key8_act() { //select url Keyboard.press(KEY_LEFT_GUI); Keyboard.write('l'); Keyboard.releaseAll(); delay(100); //copy Keyboard.press(KEY_LEFT_GUI); Keyboard.write('c'); Keyboard.releaseAll(); delay(1000); digitalWrite(LED_BUILTIN, LOW); KeyRelease(); } void Key6_act() { //move to left tab Keyboard.press(KEY_LEFT_GUI); Keyboard.press(KEY_RIGHT_ALT); Keyboard.press(KEY_LEFT_ARROW); // run spreadsheet script Keyboard.press(KEY_LEFT_GUI); Keyboard.press(KEY_RIGHT_ALT); Keyboard.press(KEY_LEFT_SHIFT); Keyboard.write('1'); Keyboard.releaseAll(); delay(3000); // paste Keyboard.press(KEY_LEFT_GUI); Keyboard.write('v'); Keyboard.releaseAll(); delay(100); digitalWrite(LED_BUILTIN, LOW); KeyRelease(); } void Key5_act() { // move to right tab Keyboard.press(KEY_LEFT_GUI); Keyboard.press(KEY_RIGHT_ALT); Keyboard.press(KEY_RIGHT_ARROW); Keyboard.releaseAll(); // tab to forcus screen Keyboard.press(KEY_TAB); digitalWrite(LED_BUILTIN, LOW); KeyRelease(); } void Key7_act() { // tab to forcus screen Keyboard.press(KEY_TAB); digitalWrite(LED_BUILTIN, LOW); KeyRelease(); } void KeyRelease() { Keyboard.releaseAll(); delay(500); digitalWrite(LED_BUILTIN, HIGH);// XIAOでは、HIGH = Off }