hello,
i have this code:
#include "Keyboard.h"
int i;
void setup() {
for (i=22; i<=53; i++){
pinMode(i, INPUT);
digitalWrite(i, HIGH);
}
pinMode(12, INPUT);
digitalWrite(12, HIGH);
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
delay(10000);
Keyboard.begin();
}
void loop() {
if (digitalRead(22) == LOW){
Keyboard.press('KEY_UP_ARROW');
digitalWrite(13, HIGH);
}
if (digitalRead(22) == HIGH){
Keyboard.release('KEY_UP_ARROW');
digitalWrite(13, LOW);
}
if (digitalRead(23) == LOW)
Keyboard.press('KEY_RIGHT_ARROW');
if (digitalRead(23) == HIGH)
Keyboard.release('KEY_RIGHT_ARROW');
if (digitalRead(24) == LOW)
Keyboard.press('KEY_DOWN_ARROW');
if (digitalRead(24) == HIGH)
Keyboard.release('KEY_DOWN_ARROW');
if (digitalRead(25) == LOW)
Keyboard.press('KEY_LEFT_ARROW');
if (digitalRead(25) == HIGH)
Keyboard.release('KEY_LEFT_ARROW');
if (digitalRead(26) == LOW)
Keyboard.press('1');
if (digitalRead(26) == HIGH)
Keyboard.release('1');
if (digitalRead(27) == LOW)
Keyboard.press(2);
if (digitalRead(27) == HIGH)
Keyboard.release(2);
if (digitalRead(28) == LOW)
Keyboard.press('KEY_LEFT_CTRL');
if (digitalRead(28) == HIGH)
Keyboard.release('KEY_LEFT_CTRL');
if (digitalRead(29) == LOW)
Keyboard.press('KEY_LEFT_ALT');
if (digitalRead(29) == HIGH)
Keyboard.release('KEY_LEFT_ALT');
if (digitalRead(53) == LOW)
Keyboard.press('5');
if (digitalRead(29) == HIGH)
Keyboard.release('5');
}
it does not work on both USB Ports, the4 LED connected on Pin 13 switches on if i put the output 22 to low.
so, where is my error?