From 940302146066667406c620acbdefa677242a40da Mon Sep 17 00:00:00 2001 From: Jaime Iniesta Date: Thu, 1 May 2014 22:22:04 +0200 Subject: [PATCH 1/5] fix comments on spaceship example The comments explaining the if..else part were mistaken. --- .../p02_SpaceshipInterface/p02_SpaceshipInterface.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/shared/examples/10.StarterKit/p02_SpaceshipInterface/p02_SpaceshipInterface.ino b/build/shared/examples/10.StarterKit/p02_SpaceshipInterface/p02_SpaceshipInterface.ino index 84893529a..2a1427637 100644 --- a/build/shared/examples/10.StarterKit/p02_SpaceshipInterface/p02_SpaceshipInterface.ino +++ b/build/shared/examples/10.StarterKit/p02_SpaceshipInterface/p02_SpaceshipInterface.ino @@ -44,7 +44,7 @@ void loop(){ switchstate = digitalRead(2); // if the button is not pressed - // blink the red LEDs + // turn on the green LED and off the red LEDs if (switchstate == LOW) { digitalWrite(3, HIGH); // turn the green LED on pin 3 on digitalWrite(4, LOW); // turn the red LED on pin 4 off @@ -52,7 +52,7 @@ void loop(){ } // this else is part of the above if() statement. // if the switch is not LOW (the button is pressed) - // the code below will run + // turn off the green LED and blink alternatively the red LEDs else { digitalWrite(3, LOW); // turn the green LED on pin 3 off digitalWrite(4, LOW); // turn the red LED on pin 4 off From cf5fc143ac8fb2d54295101879554c96203e751d Mon Sep 17 00:00:00 2001 From: Scott Fitzgerald Date: Sat, 3 May 2014 19:16:29 +0400 Subject: [PATCH 2/5] Modified Keyboard Reprogram example Updated to reflect changes with how the IDE creates new blank sketches. --- .../KeyboardReprogram/KeyboardReprogram.ino | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/build/shared/examples/09.USB/Keyboard/KeyboardReprogram/KeyboardReprogram.ino b/build/shared/examples/09.USB/Keyboard/KeyboardReprogram/KeyboardReprogram.ino index 17cb04d7b..08e47479b 100644 --- a/build/shared/examples/09.USB/Keyboard/KeyboardReprogram/KeyboardReprogram.ino +++ b/build/shared/examples/09.USB/Keyboard/KeyboardReprogram/KeyboardReprogram.ino @@ -11,12 +11,14 @@ a final key combination (CTRL-U). Circuit: - * Arduino Leonardo or Micro + * Arduino Leonardo, Micro, Due, LilyPad USB, or Yun * wire to connect D2 to ground. created 5 Mar 2012 modified 29 Mar 2012 by Tom Igoe + modified 3 May 2014 + by Scott Fitzgerald This example is in the public domain @@ -54,6 +56,18 @@ void loop() { // wait for new window to open: delay(1000); + // versions of the Arduino IDE after 1.5 pre-populate + // new sketches with setup() and loop() functions + // let's clear the window before typing anything new + // select all + Keyboard.press(ctrlKey); + Keyboard.press('a'); + delay(500); + Keyboard.releaseAll(); + // delete the selected text + Keyboard.write(KEY_BACKSPACE); + delay(500); + // Type out "blink": Keyboard.println("void setup() {"); Keyboard.println("pinMode(13, OUTPUT);"); @@ -93,3 +107,4 @@ void loop() { + From f40e4713542fa862d5b99b256a642e001a796988 Mon Sep 17 00:00:00 2001 From: "Zachary J. Fields" Date: Wed, 7 May 2014 17:39:08 -0700 Subject: [PATCH 3/5] Match return value to type in available() --- hardware/arduino/cores/arduino/HardwareSerial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/arduino/cores/arduino/HardwareSerial.cpp b/hardware/arduino/cores/arduino/HardwareSerial.cpp index eb2365f33..1a2f8ce20 100644 --- a/hardware/arduino/cores/arduino/HardwareSerial.cpp +++ b/hardware/arduino/cores/arduino/HardwareSerial.cpp @@ -426,7 +426,7 @@ void HardwareSerial::end() int HardwareSerial::available(void) { - return (unsigned int)(SERIAL_BUFFER_SIZE + _rx_buffer->head - _rx_buffer->tail) % SERIAL_BUFFER_SIZE; + return (int)(SERIAL_BUFFER_SIZE + _rx_buffer->head - _rx_buffer->tail) % SERIAL_BUFFER_SIZE; } int HardwareSerial::peek(void) From 9ad8748d40ad0033abd9431335af93bdf9ca5e4f Mon Sep 17 00:00:00 2001 From: Scott Fitzgerald Date: Thu, 8 May 2014 23:05:53 +0400 Subject: [PATCH 4/5] Updated Blink MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit removed the variable “led” and added some additional descriptive text --- .../shared/examples/01.Basics/Blink/Blink.ino | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/build/shared/examples/01.Basics/Blink/Blink.ino b/build/shared/examples/01.Basics/Blink/Blink.ino index 15b991140..b0db92b86 100644 --- a/build/shared/examples/01.Basics/Blink/Blink.ino +++ b/build/shared/examples/01.Basics/Blink/Blink.ino @@ -1,24 +1,29 @@ /* Blink Turns on an LED on for one second, then off for one second, repeatedly. - + + Most Arduinos have an on-board LED you can control. On the Uno and + Leonardo, it is attached to digital pin 13. If you're unsure what + pin the on-board LED is connected to on your Arduino model, check + the documentation at http://arduino.cc + This example code is in the public domain. + + modified 8 May 2014 + by Scott Fitzgerald */ - -// Pin 13 has an LED connected on most Arduino boards. -// give it a name: -int led = 13; -// the setup routine runs once when you press reset: -void setup() { - // initialize the digital pin as an output. - pinMode(led, OUTPUT); + +// the setup function runs once when you press reset or power the board +void setup() { + // initialize digital pin 13 as an output. + pinMode(13, OUTPUT); } -// the loop routine runs over and over again forever: +// the loop function runs over and over again forever void loop() { - digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) - delay(1000); // wait for a second - digitalWrite(led, LOW); // turn the LED off by making the voltage LOW - delay(1000); // wait for a second + digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) + delay(1000); // wait for a second + digitalWrite(13, LOW); // turn the LED off by making the voltage LOW + delay(1000); // wait for a second } From 17e1eb5ef240e33511d86d191b5da31ce8cdec2b Mon Sep 17 00:00:00 2001 From: Jens-Christian Skibakk Date: Fri, 23 May 2014 11:29:30 +0200 Subject: [PATCH 5/5] Fix idle level when initializing a inverted SoftwareSerial Previously, when SoftwareSerial was initialized, it would always be set to an idle level of HIGH, even when inverted logic was enabled. Once a byte is transmitted, the idle level gets correctly set to LOW instead. This commit makes sure that the idle level is correct directly after initialization already. This fixes #1361. --- libraries/SoftwareSerial/SoftwareSerial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/SoftwareSerial/SoftwareSerial.cpp b/libraries/SoftwareSerial/SoftwareSerial.cpp index 64496febb..d1f6c9256 100755 --- a/libraries/SoftwareSerial/SoftwareSerial.cpp +++ b/libraries/SoftwareSerial/SoftwareSerial.cpp @@ -355,7 +355,7 @@ SoftwareSerial::~SoftwareSerial() void SoftwareSerial::setTX(uint8_t tx) { pinMode(tx, OUTPUT); - digitalWrite(tx, HIGH); + digitalWrite(tx, _inverse_logic ? LOW : HIGH); _transmitBitMask = digitalPinToBitMask(tx); uint8_t port = digitalPinToPort(tx); _transmitPortRegister = portOutputRegister(port);