1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00

bug fixes to StateChangeDetection and ToneMelody examples

This commit is contained in:
Tom Igoe
2010-10-14 14:46:51 -04:00
parent 9cad196ae5
commit 81de2b5a05
2 changed files with 8 additions and 5 deletions

View File

@ -16,7 +16,7 @@
most Arduino boards) most Arduino boards)
created 27 Sep 2005 created 27 Sep 2005
modified 30 Dec 2009 modified 14 Oct 2010
by Tom Igoe by Tom Igoe
This example code is in the public domain. This example code is in the public domain.
@ -64,11 +64,11 @@ void loop() {
// wend from on to off: // wend from on to off:
Serial.println("off"); Serial.println("off");
} }
// save the current state as the last state,
//for next time through the loop
lastButtonState = buttonState;
} }
// save the current state as the last state,
//for next time through the loop
lastButtonState = buttonState;
// turns on the LED every four button pushes by // turns on the LED every four button pushes by
// checking the modulo of the button push counter. // checking the modulo of the button push counter.

View File

@ -7,6 +7,7 @@
* 8-ohm speaker on digital pin 8 * 8-ohm speaker on digital pin 8
created 21 Jan 2010 created 21 Jan 2010
modified 14 Oct 2010
by Tom Igoe by Tom Igoe
This example code is in the public domain. This example code is in the public domain.
@ -38,6 +39,8 @@ void setup() {
// the note's duration + 30% seems to work well: // the note's duration + 30% seems to work well:
int pauseBetweenNotes = noteDuration * 1.30; int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes); delay(pauseBetweenNotes);
// stop the tone playing:
noTone(8);
} }
} }