Skip to content

Commit dbf464e

Browse files
committed
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
2 parents 1e9edf9 + eb78356 commit dbf464e

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

examples/02.Digital/Debounce/Debounce.ino

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,18 @@
1919
by David A. Mellis
2020
modified 30 Aug 2011
2121
by Limor Fried
22+
modified 28 Dec 2012
23+
by Mike Walters
2224
23-
This example code is in the public domain.
25+
This example code is in the public domain.
2426
2527
http://www.arduino.cc/en/Tutorial/Debounce
2628
*/
2729

2830
// constants won't change. They're used here to
2931
// set pin numbers:
30-
const int buttonPin = 2; // the number of the pushbutton pin
31-
const int ledPin = 13; // the number of the LED pin
32+
const int buttonPin = 2; // the number of the pushbutton pin
33+
const int ledPin = 13; // the number of the LED pin
3234

3335
// Variables will change:
3436
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
4345
void setup() {
4446
pinMode(buttonPin, INPUT);
4547
pinMode(ledPin, OUTPUT);
48+
49+
// set initial LED state
50+
digitalWrite(ledPin, ledState);
4651
}
4752

4853
void loop() {
@@ -62,11 +67,20 @@ void loop() {
6267
if ((millis() - lastDebounceTime) > debounceDelay) {
6368
// whatever the reading is at, it's been there for longer
6469
// than the debounce delay, so take it as the actual current state:
65-
buttonState = reading;
70+
71+
// if the button state has changed:
72+
if (reading != buttonState) {
73+
buttonState = reading;
74+
75+
// only toggle the LED if the new button state is HIGH
76+
if (buttonState == HIGH) {
77+
ledState = !ledState;
78+
}
79+
}
6680
}
6781

68-
// set the LED using the state of the button:
69-
digitalWrite(ledPin, buttonState);
82+
// set the LED:
83+
digitalWrite(ledPin, ledState);
7084

7185
// save the reading. Next time through the loop,
7286
// it'll be the lastButtonState:

examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
http://www.arduino.cc/en/Tutorial/KeyboardButton
2020
*/
2121

22-
const int buttonPin = 2; // input pin for pushbutton
22+
const int buttonPin = 4; // input pin for pushbutton
2323
int previousButtonState = HIGH; // for checking the state of a pushButton
2424
int counter = 0; // button push counter
2525

0 commit comments

Comments
 (0)