Skip to content

Commit

Permalink
013 fix 2
Browse files Browse the repository at this point in the history
  • Loading branch information
zmaker committed Jul 5, 2018
1 parent 9966cae commit 3aed93f
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 0 deletions.
16 changes: 16 additions & 0 deletions 019-debouncing/019-debouncing-completo/019-debouncing2.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
long t = 0;
long debounce_delay = 2000;

void setup() {
pinMode(7, INPUT);
Serial.begin(9600);
}

void loop() {
if ( digitalRead(7) ){
if ( (millis() - t) > debounce_delay) {
Serial.println("ok");
t = millis();
}
}
}
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions 019-debouncing/019-debouncing-con-delay/019-debouncing1-delay.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
void setup() {
pinMode(7, INPUT);
Serial.begin(9600);
}

void loop() {
if (digitalRead(7)) {
delay(200);
Serial.println("B1");
}

}
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3aed93f

Please sign in to comment.