Hi i'm supper new and have a question, so far i've built this entire command and ordered this arduino from the internet without any prior teaching on it but am stuck now. i tried searching before asking.
i am using an arduino pro micro to to emulate a keyboard and type a set of commands on my work computer to save me hours of work.
my goal is to plug in the usb push the button that makes connection when pushed. start this line of code. then to repeat over and over until the button is pushed again. what i have so far is
#include <Keyboard.h> // This is a "built-in" library no need to install
//---------------------------------------------------------
// Setup
//---------------------------------------------------------
void setup() {
pinMode(3,INPUT_PULLUP); // sets pin 3 to input & pulls it high w/ internal resistor
Serial.begin(9600); // begin serial comms for debugging
}
//---------------------------------------------------------
// Loop
//---------------------------------------------------------
void loop() {
Keyboard.begin(); //begin keyboard
if (digitalRead(3) == 0) // if buton 3 is pushed
{
Keyboard.write(0xD9); // down arrow
delay(200); //
Keyboard.write(0x82);
delay(200);
Keyboard.press('p');
delay(200);
Keyboard.releaseAll();
delay(200);
Keyboard.write(0x82);
delay(200);
Keyboard.press('i');
delay(200);
Keyboard.releaseAll();
delay(200);
Keyboard.write(0x82);
delay(200);
Keyboard.press('f');
delay(200);
Keyboard.releaseAll();
delay(200);
Keyboard.press(0xB3);
delay(200);
Keyboard.releaseAll();
delay(200);
Keyboard.press(0xB3);
delay(200);
Keyboard.releaseAll();
delay(200);
Keyboard.press(0xB3);
delay(200);
Keyboard.releaseAll();
delay(200);
Keyboard.press('y');
delay(200);
Keyboard.releaseAll();
delay(200);
Keyboard.press(0x82);
delay(200);
Keyboard.press('s');
delay(200);
Keyboard.releaseAll();
delay(200);
}
Keyboard.end(); //stops keybord
}
any help would be appreciated and any other pointers. the code works fine but i have to push the button again every time which wouldnt save anytime?