From 4869f7f979b1be764fb5403db4812777b717deaa Mon Sep 17 00:00:00 2001 From: Scott Fitzgerald Date: Mon, 11 Nov 2013 16:19:48 +0400 Subject: [PATCH 1/4] Updated listfiles SD example Updated description of the file --- libraries/SD/examples/listfiles/listfiles.ino | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/SD/examples/listfiles/listfiles.ino b/libraries/SD/examples/listfiles/listfiles.ino index d403073b6..08ded5057 100644 --- a/libraries/SD/examples/listfiles/listfiles.ino +++ b/libraries/SD/examples/listfiles/listfiles.ino @@ -1,7 +1,9 @@ /* - SD card basic file example + Listfiles - This example shows how to create and destroy an SD card file + This example shows how print out the files in a + directory on a SD card + The circuit: * SD card attached to SPI bus as follows: ** MOSI - pin 11 @@ -29,7 +31,6 @@ void setup() ; // wait for serial port to connect. Needed for Leonardo only } - Serial.print("Initializing SD card..."); // On the Ethernet Shield, CS is pin 4. It's set as an output by default. // Note that even if it's not used as the CS pin, the hardware SS pin @@ -61,7 +62,6 @@ void printDirectory(File dir, int numTabs) { File entry = dir.openNextFile(); if (! entry) { // no more files - //Serial.println("**nomorefiles**"); break; } for (uint8_t i=0; i Date: Mon, 11 Nov 2013 16:31:25 +0400 Subject: [PATCH 2/4] Updated Blink without delay example Changed variable to unsigned long. --- .../BlinkWithoutDelay/BlinkWithoutDelay.ino | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/build/shared/examples/02.Digital/BlinkWithoutDelay/BlinkWithoutDelay.ino b/build/shared/examples/02.Digital/BlinkWithoutDelay/BlinkWithoutDelay.ino index 014357191..56b274efc 100644 --- a/build/shared/examples/02.Digital/BlinkWithoutDelay/BlinkWithoutDelay.ino +++ b/build/shared/examples/02.Digital/BlinkWithoutDelay/BlinkWithoutDelay.ino @@ -9,29 +9,31 @@ * Note: on most Arduinos, there is already an LED on the board that's attached to pin 13, so no hardware is needed for this example. - created 2005 by David A. Mellis modified 8 Feb 2010 by Paul Stoffregen + modified 11 Nov 2013 + by Scott Fitzgerald + This example code is in the public domain. - http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay */ -// constants won't change. Used here to -// set pin numbers: +// constants won't change. Used here to set a pin number : const int ledPin = 13; // the number of the LED pin -// Variables will change: +// Variables will change : int ledState = LOW; // ledState used to set the LED -long previousMillis = 0; // will store last time LED was updated -// the follow variables is a long because the time, measured in miliseconds, -// will quickly become a bigger number than can be stored in an int. -long interval = 1000; // interval at which to blink (milliseconds) +// Generally, you shuould use "unsigned long" for variables that hold time +// The value will quickly become too large for an int to store +unsigned long previousMillis = 0; // will store last time LED was updated + +// constants won't change : +const long interval = 1000; // interval at which to blink (milliseconds) void setup() { // set the digital pin as output: @@ -48,7 +50,7 @@ void loop() // blink the LED. unsigned long currentMillis = millis(); - if(currentMillis - previousMillis > interval) { + if(currentMillis - previousMillis >= interval) { // save the last time you blinked the LED previousMillis = currentMillis; From b332904ee141f578446b155c08a24ffde90cb8b5 Mon Sep 17 00:00:00 2001 From: Scott Fitzgerald Date: Mon, 11 Nov 2013 16:41:12 +0400 Subject: [PATCH 3/4] Modified LCD custom character example moved lcd.begin() to the beginnng of the setup() and fixed an issue that prevented the example from compiling. When calling lcd.write() with an argument of 0, the 0 must be cast a s a byte. --- .../examples/CustomCharacter/CustomCharacter.ino | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/libraries/LiquidCrystal/examples/CustomCharacter/CustomCharacter.ino b/libraries/LiquidCrystal/examples/CustomCharacter/CustomCharacter.ino index d3ce47924..f714a3a44 100644 --- a/libraries/LiquidCrystal/examples/CustomCharacter/CustomCharacter.ino +++ b/libraries/LiquidCrystal/examples/CustomCharacter/CustomCharacter.ino @@ -22,8 +22,11 @@ * wiper to LCD VO pin (pin 3) * 10K poterntiometer on pin A0 - created21 Mar 2011 + created 21 Mar 2011 by Tom Igoe + modified 11 Nov 2013 + by Scott Fitzgerald + Based on Adafruit's example at https://github.com/adafruit/SPI_VFD/blob/master/examples/createChar/createChar.pde @@ -96,7 +99,11 @@ byte armsUp[8] = { 0b00100, 0b01010 }; + void setup() { + // initialize LCD and set up the number of columns and rows: + lcd.begin(16, 2); + // create a new character lcd.createChar(0, heart); // create a new character @@ -108,11 +115,9 @@ void setup() { // create a new character lcd.createChar(4, armsUp); - // set up the lcd's number of columns and rows: - lcd.begin(16, 2); // Print a message to the lcd. lcd.print("I "); - lcd.write(0); + lcd.write(byte(0)); // when calling lcd.write() '0' must be cast as a byte lcd.print(" Arduino! "); lcd.write(1); @@ -133,6 +138,3 @@ void loop() { lcd.write(4); delay(delayTime); } - - - From b79ee023de77c67ad327df673cf469d2a0e3a00a Mon Sep 17 00:00:00 2001 From: Scott Fitzgerald Date: Mon, 11 Nov 2013 16:47:49 +0400 Subject: [PATCH 4/4] Updated KeyboardMessage example --- .../09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build/shared/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino b/build/shared/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino index 39222fdaa..1f17668d1 100644 --- a/build/shared/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino +++ b/build/shared/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino @@ -1,21 +1,23 @@ /* - Keyboard Button test + Keyboard Message test For the Arduino Leonardo and Micro. Sends a text string when a button is pressed. The circuit: - * pushbutton attached from pin 2 to +5V + * pushbutton attached from pin 4 to +5V * 10-kilohm resistor attached from pin 4 to ground created 24 Oct 2011 modified 27 Mar 2012 by Tom Igoe + modified 11 Nov 2013 + by Scott Fitzgerald This example code is in the public domain. - http://www.arduino.cc/en/Tutorial/KeyboardButton + http://www.arduino.cc/en/Tutorial/KeyboardMessage */ const int buttonPin = 4; // input pin for pushbutton