#include <Keyboard.h>
void setup(){
pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
Keyboard.begin();
}
void loop(){
checkPress(2, 'd');
checkPress(3, 'f');
checkPress(4, 'g');
checkPress(5, 'h');
}
void checkPress(int pin, char key) {
if (digitalRead(pin)) {
Keyboard.press(key);
}
else {
Keyboard.release(key);
}
}
#include <Keyboard.h>
const int delayValue = 100;
const char cmdKey = KEY_LEFT_GUI;
void setup(){
pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
Keyboard.begin();
}
void loop(){
if (digitalRead(2)) {
Keyboard.press(cmdKey);
Keyboard.press('c');
delay(delayValue);
Keyboard.releaseAll();
while(digitalRead(2));
}
if (digitalRead(3)) {
Keyboard.press(cmdKey);
Keyboard.press('v');
delay(delayValue);
Keyboard.releaseAll();
while(digitalRead(3));
}
if (digitalRead(4)) {
Keyboard.press(cmdKey);
Keyboard.press('n');
delay(delayValue);
Keyboard.releaseAll();
while(digitalRead(4));
}
if (digitalRead(5)) {
Keyboard.press(cmdKey);
Keyboard.press('z');
delay(delayValue);
Keyboard.releaseAll();
while(digitalRead(5));
}
}
#include <Keyboard.h>
void setup(){
pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
Keyboard.begin();
}
void loop(){
checkPress(2, 'd');
checkPress(3, 'f');
checkPress(4, 'g');
checkPress(5, 'h');
}
void checkPress(int pin, char key) {
if (digitalRead(pin)) {
Keyboard.press(key);
}
else {
Keyboard.release(key);
}
}
#include <Keyboard.h>
const int delayValue = 100;
const char cmdKey = KEY_LEFT_GUI;
void setup(){
pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
Keyboard.begin();
}
void loop(){
if (digitalRead(2)) {
Keyboard.press(cmdKey);
Keyboard.press('c');
delay(delayValue);
Keyboard.releaseAll();
while(digitalRead(2));
}
if (digitalRead(3)) {
Keyboard.press(cmdKey);
Keyboard.press('v');
delay(delayValue);
Keyboard.releaseAll();
while(digitalRead(3));
}
if (digitalRead(4)) {
Keyboard.press(cmdKey);
Keyboard.press('n');
delay(delayValue);
Keyboard.releaseAll();
while(digitalRead(4));
}
if (digitalRead(5)) {
Keyboard.press(cmdKey);
Keyboard.press('z');
delay(delayValue);
Keyboard.releaseAll();
while(digitalRead(5));
}
}