Changed BUTTON_PIN to INPUT_PULLUP; Seems to work more reliable on PIN1 (LED_PIN)
This commit is contained in:
parent
d40e9aaa9a
commit
714f8ff2c1
1 changed files with 1 additions and 3 deletions
|
|
@ -46,13 +46,12 @@ const char *passwords[] = {
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// Set button pin to be INPUT.
|
// Set button pin to be INPUT.
|
||||||
pinMode(BUTTON_PIN, INPUT);
|
pinMode(BUTTON_PIN, INPUT_PULLUP);
|
||||||
// Set BUTTON_PIN pin to LOW because the button is connected
|
// Set BUTTON_PIN pin to LOW because the button is connected
|
||||||
// to VCC when pressed and will go HIGH. Before glow up for 1 second to show the device is ready.
|
// to VCC when pressed and will go HIGH. Before glow up for 1 second to show the device is ready.
|
||||||
digitalWrite(BUTTON_PIN, HIGH);
|
digitalWrite(BUTTON_PIN, HIGH);
|
||||||
delay(1000);
|
delay(1000);
|
||||||
digitalWrite(BUTTON_PIN, LOW);
|
digitalWrite(BUTTON_PIN, LOW);
|
||||||
|
|
||||||
// Initialize HID
|
// Initialize HID
|
||||||
DigiKeyboard.delay(0);
|
DigiKeyboard.delay(0);
|
||||||
DigiKeyboard.sendKeyStroke(0);
|
DigiKeyboard.sendKeyStroke(0);
|
||||||
|
|
@ -70,7 +69,6 @@ void loop() {
|
||||||
// Set the last press timestamp
|
// Set the last press timestamp
|
||||||
last = millis();
|
last = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait PAUSE time before executing a command
|
// Wait PAUSE time before executing a command
|
||||||
if (count > 0 && (millis() - last) >= PAUSE) {
|
if (count > 0 && (millis() - last) >= PAUSE) {
|
||||||
// The switch case is the number of button presses
|
// The switch case is the number of button presses
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue