I am attempting to build a keyboard emulator using a original Arduino Micro. When the first key on the keyboard is pressed I want it to send a CTRL A out of the usb interface to my desktop computer to highlight all vectors in a drawing that was drawn using my Vectric Aspire software.The code shown below will compile and upload without any issues. When I pull pin 2 low it appears that the CTRL A is not sent to the desktop. However, when i comment out the line (Keyboard.press(KEY_LEFT_CTRL)) the letter A is sent out of the usb interface to my desktop which proves that the Micro is communicating with my desktop. According to what I have researched online and found in one of my Arduino reference books what I have done with the code is correct but I must be missing something since the CTRL A is not being sent to the desktop. Any assistance would be most appreciated.
Thank you,
Robert B
// VERSOIN 1.1 RDB 12/31/2025 RDB
// ARDUINO MICRO
#include <Keyboard.h>
void setup() {
Keyboard.begin();
Serial.begin(9600);
pinMode(2, INPUT_PULLUP);
}
void loop() {
// SELECT ALL VECTORS
if (digitalRead(2) == LOW) {
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press('A');
delay(100);
Keyboard.releaseAll();
Serial.println("Pressing CTRL KEY and A");
delay(4000);
}
}