Added password examples and some comments about the features.
This commit is contained in:
parent
a047580155
commit
96d4a99aec
1 changed files with 19 additions and 14 deletions
|
|
@ -16,11 +16,14 @@ unsigned int count;
|
||||||
Blinker blinker(LED_PIN);
|
Blinker blinker(LED_PIN);
|
||||||
|
|
||||||
// the list of available passwords
|
// the list of available passwords
|
||||||
|
// the number and overall lenght of passwords depends because the memory of the digispark is very limited...
|
||||||
|
// i recommend to use a prefix you easily can remember for the password/passwords to make the passwords
|
||||||
|
// on the passkey unusable for others if you have lost your passkey. E.g.: WhatAWonderfulWorld -> then press the button.
|
||||||
const char *passwords[] = {
|
const char *passwords[] = {
|
||||||
"PASSWORD1",
|
"n0Emb871NAQPSIqBoldh8R7UDaNhncF7Pt60Amdo6GWdTdAPwVBi2A3KU8x8DTCRo6GWdTdXNn2wLh3SUbxVWQvFDVPtatDg", // passwords[0]
|
||||||
"PASSWORD2",
|
"oaxt6e3lSgflOuJ3C6Q6sUb5gvmvI5IEPFku5fqcbxJljBOUblHIT121wCu", // passwords[1]
|
||||||
"PASSWORD3",
|
"jUgKGBtiJ0iNN1Ok9vejrXNn2wLh3SUbxVWQvFDVPtat0OxJlKU8x8DTCRo6GWdTdAPwVBi2A3KUrTKQwjUgK", // passwords[2]
|
||||||
"PASSWORD4"
|
"G57dFnXsPUnRq1eC1CjrGxpCjuiJFlDti54W6wBS9Ro6GWdTdAPwVBi2A3KU8x8KGBtiJ0iNN1Ok9vejrXNn2wLhH" // etc...
|
||||||
};
|
};
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
@ -28,19 +31,19 @@ void setup() {
|
||||||
pinMode(BUTTON_PIN, INPUT);
|
pinMode(BUTTON_PIN, INPUT);
|
||||||
digitalWrite(BUTTON_PIN, HIGH);
|
digitalWrite(BUTTON_PIN, HIGH);
|
||||||
|
|
||||||
|
// set blink effect (ON, OFF) in milliseconds
|
||||||
|
blinker.setDelay(25, 10000);
|
||||||
|
blinker.start();
|
||||||
|
|
||||||
|
// initialize HID
|
||||||
|
DigiKeyboard.delay(0);
|
||||||
|
DigiKeyboard.sendKeyStroke(0);
|
||||||
|
|
||||||
// light up the LED for a second to show that passkey is ready
|
// light up the LED for a second to show that passkey is ready
|
||||||
pinMode(LED_PIN, OUTPUT);
|
pinMode(LED_PIN, OUTPUT);
|
||||||
digitalWrite(LED_PIN, HIGH);
|
digitalWrite(LED_PIN, HIGH);
|
||||||
delay(1000);
|
delay(1000);
|
||||||
digitalWrite(LED_PIN, LOW);
|
digitalWrite(LED_PIN, LOW);
|
||||||
|
|
||||||
// set blink effect (ON, OFF) in milliseconds
|
|
||||||
blinker.setDelay(25, 10000);
|
|
||||||
blinker.start();
|
|
||||||
|
|
||||||
// initialize HID
|
|
||||||
DigiKeyboard.delay(0);
|
|
||||||
DigiKeyboard.sendKeyStroke(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
@ -53,7 +56,7 @@ void loop() {
|
||||||
last = millis();
|
last = millis();
|
||||||
count++;
|
count++;
|
||||||
// wait until button is released
|
// wait until button is released
|
||||||
while(digitalRead(BUTTON_PIN) == LOW) {
|
while (digitalRead(BUTTON_PIN) == LOW) {
|
||||||
delay(1);
|
delay(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -61,7 +64,7 @@ void loop() {
|
||||||
// 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
|
||||||
switch(count) {
|
switch (count) {
|
||||||
case 1:
|
case 1:
|
||||||
DigiKeyboard.println(passwords[0]);
|
DigiKeyboard.println(passwords[0]);
|
||||||
break;
|
break;
|
||||||
|
|
@ -72,7 +75,9 @@ void loop() {
|
||||||
DigiKeyboard.println(passwords[2]);
|
DigiKeyboard.println(passwords[2]);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
DigiKeyboard.println(passwords[3]);
|
// you can use print instead of println if you don't want to
|
||||||
|
// hit enter automatically after inserting the password
|
||||||
|
DigiKeyboard.print(passwords[3]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue