mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Merged 1.0.5
Still missing: - updates to WiFi lib for sam. - updates to examples of Ehternet and WiFi for sam. Merge remote-tracking branch 'arduino/master' into ide-1.5.x Conflicts: app/src/processing/app/Base.java app/src/processing/app/Editor.java app/src/processing/app/helpers/FileUtils.java app/src/processing/app/i18n/Resources_fr.po app/src/processing/app/i18n/Resources_fr.properties build/shared/revisions.txt hardware/arduino/avr/libraries/Ethernet/examples/DnsWebClient/DnsWebClient.ino hardware/arduino/avr/libraries/WiFi/examples/WifiChatServer/WifiChatServer.ino hardware/arduino/avr/libraries/WiFi/examples/WifiPachubeClient/WifiPachubeClient.ino hardware/arduino/avr/libraries/WiFi/examples/WifiPachubeClientString/WifiPachubeClientString.ino hardware/arduino/avr/libraries/WiFi/examples/WifiTwitterClient/WifiTwitterClient.ino hardware/arduino/avr/libraries/WiFi/examples/WifiUdpSendReceiveString/WifiUdpSendReceiveString.ino hardware/arduino/avr/libraries/WiFi/examples/WifiWebClient/WifiWebClient.ino hardware/arduino/avr/libraries/WiFi/examples/WifiWebClientRepeating/WifiWebClientRepeating.ino hardware/arduino/avr/libraries/WiFi/examples/WifiWebServer/WifiWebServer.ino libraries/WiFi/examples/WiFiChatServer/WiFiChatServer.ino libraries/WiFi/examples/WiFiPachubeClient/WiFiPachubeClient.ino libraries/WiFi/examples/WiFiPachubeClientString/WiFiPachubeClientString.ino libraries/WiFi/examples/WiFiTwitterClient/WiFiTwitterClient.ino libraries/WiFi/examples/WiFiUdpSendReceiveString/WiFiUdpSendReceiveString.ino libraries/WiFi/examples/WiFiWebClient/WiFiWebClient.ino libraries/WiFi/examples/WiFiWebClientRepeating/WiFiWebClientRepeating.ino libraries/WiFi/examples/WiFiWebServer/WiFiWebServer.ino libraries/WiFi/examples/WifiChatServer/WifiChatServer.ino libraries/WiFi/examples/WifiPachubeClient/WifiPachubeClient.ino libraries/WiFi/examples/WifiPachubeClientString/WifiPachubeClientString.ino libraries/WiFi/examples/WifiTwitterClient/WifiTwitterClient.ino libraries/WiFi/examples/WifiUdpSendReceiveString/WifiUdpSendReceiveString.ino libraries/WiFi/examples/WifiWebClient/WifiWebClient.ino libraries/WiFi/examples/WifiWebClientRepeating/WifiWebClientRepeating.ino libraries/WiFi/examples/WifiWebServer/WifiWebServer.ino
This commit is contained in:
@ -19,16 +19,18 @@
|
||||
by David A. Mellis
|
||||
modified 30 Aug 2011
|
||||
by Limor Fried
|
||||
modified 28 Dec 2012
|
||||
by Mike Walters
|
||||
|
||||
This example code is in the public domain.
|
||||
This example code is in the public domain.
|
||||
|
||||
http://www.arduino.cc/en/Tutorial/Debounce
|
||||
*/
|
||||
|
||||
// constants won't change. They're used here to
|
||||
// set pin numbers:
|
||||
const int buttonPin = 2; // the number of the pushbutton pin
|
||||
const int ledPin = 13; // the number of the LED pin
|
||||
const int buttonPin = 2; // the number of the pushbutton pin
|
||||
const int ledPin = 13; // the number of the LED pin
|
||||
|
||||
// Variables will change:
|
||||
int ledState = HIGH; // the current state of the output pin
|
||||
@ -43,6 +45,9 @@ long debounceDelay = 50; // the debounce time; increase if the output flicker
|
||||
void setup() {
|
||||
pinMode(buttonPin, INPUT);
|
||||
pinMode(ledPin, OUTPUT);
|
||||
|
||||
// set initial LED state
|
||||
digitalWrite(ledPin, ledState);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
@ -62,11 +67,20 @@ void loop() {
|
||||
if ((millis() - lastDebounceTime) > debounceDelay) {
|
||||
// whatever the reading is at, it's been there for longer
|
||||
// than the debounce delay, so take it as the actual current state:
|
||||
buttonState = reading;
|
||||
|
||||
// if the button state has changed:
|
||||
if (reading != buttonState) {
|
||||
buttonState = reading;
|
||||
|
||||
// only toggle the LED if the new button state is HIGH
|
||||
if (buttonState == HIGH) {
|
||||
ledState = !ledState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set the LED using the state of the button:
|
||||
digitalWrite(ledPin, buttonState);
|
||||
// set the LED:
|
||||
digitalWrite(ledPin, ledState);
|
||||
|
||||
// save the reading. Next time through the loop,
|
||||
// it'll be the lastButtonState:
|
||||
|
Reference in New Issue
Block a user