所以我想用Arduino Leonardo作爲內置庫的鍵盤輸入。Arduino Leonardo鍵盤行爲
boolean on;
void setup() {
pinMode(13, OUTPUT);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
Keyboard.begin();
on = true;
}
void loop() {
if(digitalRead(2) == LOW) {
Keyboard.end();
on = false;
}
digitalWrite(13, on);
if(digitalRead(3) == LOW) {
Keyboard.press('w');
}
else {
Keyboard.release('w');
}
}
在我運行「Keyboard.end()」後,「Keyboard.press()」功能仍然正常工作是否正常?
我只是不希望Arduino打破,所以在此先感謝您的答案!