mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-20 14:54:31 +01:00
bug fixes to StateChangeDetection and ToneMelody examples
This commit is contained in:
parent
9cad196ae5
commit
81de2b5a05
@ -16,7 +16,7 @@
|
||||
most Arduino boards)
|
||||
|
||||
created 27 Sep 2005
|
||||
modified 30 Dec 2009
|
||||
modified 14 Oct 2010
|
||||
by Tom Igoe
|
||||
|
||||
This example code is in the public domain.
|
||||
@ -64,11 +64,11 @@ void loop() {
|
||||
// wend from on to 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
|
||||
// checking the modulo of the button push counter.
|
||||
|
@ -7,6 +7,7 @@
|
||||
* 8-ohm speaker on digital pin 8
|
||||
|
||||
created 21 Jan 2010
|
||||
modified 14 Oct 2010
|
||||
by Tom Igoe
|
||||
|
||||
This example code is in the public domain.
|
||||
@ -38,6 +39,8 @@ void setup() {
|
||||
// the note's duration + 30% seems to work well:
|
||||
int pauseBetweenNotes = noteDuration * 1.30;
|
||||
delay(pauseBetweenNotes);
|
||||
// stop the tone playing:
|
||||
noTone(8);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user