Made the code more readable and native.
This commit is contained in:
parent
485e474899
commit
f6d0db5d87
2 changed files with 66 additions and 64 deletions
12
Passkey.ino
12
Passkey.ino
|
|
@ -21,8 +21,10 @@
|
||||||
|
|
||||||
// The button pin
|
// The button pin
|
||||||
#define BUTTON_PIN 0
|
#define BUTTON_PIN 0
|
||||||
|
|
||||||
// The LED pin
|
// The LED pin
|
||||||
#define LED_PIN 1
|
#define LED_PIN 1
|
||||||
|
|
||||||
// The pause after last button press before executing a command
|
// The pause after last button press before executing a command
|
||||||
#define PAUSE 2000
|
#define PAUSE 2000
|
||||||
|
|
||||||
|
|
@ -30,8 +32,8 @@
|
||||||
unsigned long last;
|
unsigned long last;
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
|
|
||||||
// Create blinker object
|
// Create Blinker object
|
||||||
Blinker blinker(LED_PIN);
|
Blinker Blinker(LED_PIN);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// Set button pin to high.
|
// Set button pin to high.
|
||||||
|
|
@ -41,9 +43,9 @@ void setup() {
|
||||||
digitalWrite(BUTTON_PIN, HIGH);
|
digitalWrite(BUTTON_PIN, HIGH);
|
||||||
|
|
||||||
// Set blink effect (ON, OFF) in milliseconds
|
// Set blink effect (ON, OFF) in milliseconds
|
||||||
blinker.setDelay(25, 9075);
|
Blinker.setDelay(25, 9075);
|
||||||
// Start LED blink effect
|
// Start LED blink effect
|
||||||
blinker.start();
|
Blinker.start();
|
||||||
|
|
||||||
// Initialize HID
|
// Initialize HID
|
||||||
DigiKeyboard.delay(0);
|
DigiKeyboard.delay(0);
|
||||||
|
|
@ -58,7 +60,7 @@ void setup() {
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// Invoke the Blinker
|
// Invoke the Blinker
|
||||||
blinker.blink();
|
Blinker.blink();
|
||||||
|
|
||||||
// Read button state
|
// Read button state
|
||||||
if (digitalRead(BUTTON_PIN) == LOW) {
|
if (digitalRead(BUTTON_PIN) == LOW) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue