Merge remote-tracking branch 'arduino/master'

This commit is contained in:
Cristian Maglie 2013-11-12 09:38:43 +01:00
commit bd04a9d3f5
4 changed files with 30 additions and 24 deletions

View File

@ -9,29 +9,31 @@
* Note: on most Arduinos, there is already an LED on the board * 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. that's attached to pin 13, so no hardware is needed for this example.
created 2005 created 2005
by David A. Mellis by David A. Mellis
modified 8 Feb 2010 modified 8 Feb 2010
by Paul Stoffregen by Paul Stoffregen
modified 11 Nov 2013
by Scott Fitzgerald
This example code is in the public domain. This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay
*/ */
// constants won't change. Used here to // constants won't change. Used here to set a pin number :
// set pin numbers:
const int ledPin = 13; // the number of the LED pin 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 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, // Generally, you shuould use "unsigned long" for variables that hold time
// will quickly become a bigger number than can be stored in an int. // The value will quickly become too large for an int to store
long interval = 1000; // interval at which to blink (milliseconds) 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() { void setup() {
// set the digital pin as output: // set the digital pin as output:
@ -48,7 +50,7 @@ void loop()
// blink the LED. // blink the LED.
unsigned long currentMillis = millis(); unsigned long currentMillis = millis();
if(currentMillis - previousMillis > interval) { if(currentMillis - previousMillis >= interval) {
// save the last time you blinked the LED // save the last time you blinked the LED
previousMillis = currentMillis; previousMillis = currentMillis;

View File

@ -1,21 +1,23 @@
/* /*
Keyboard Button test Keyboard Message test
For the Arduino Leonardo and Micro. For the Arduino Leonardo and Micro.
Sends a text string when a button is pressed. Sends a text string when a button is pressed.
The circuit: 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 * 10-kilohm resistor attached from pin 4 to ground
created 24 Oct 2011 created 24 Oct 2011
modified 27 Mar 2012 modified 27 Mar 2012
by Tom Igoe by Tom Igoe
modified 11 Nov 2013
by Scott Fitzgerald
This example code is in the public domain. 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 const int buttonPin = 4; // input pin for pushbutton

View File

@ -22,8 +22,11 @@
* wiper to LCD VO pin (pin 3) * wiper to LCD VO pin (pin 3)
* 10K poterntiometer on pin A0 * 10K poterntiometer on pin A0
created21 Mar 2011 created 21 Mar 2011
by Tom Igoe by Tom Igoe
modified 11 Nov 2013
by Scott Fitzgerald
Based on Adafruit's example at Based on Adafruit's example at
https://github.com/adafruit/SPI_VFD/blob/master/examples/createChar/createChar.pde https://github.com/adafruit/SPI_VFD/blob/master/examples/createChar/createChar.pde
@ -96,7 +99,11 @@ byte armsUp[8] = {
0b00100, 0b00100,
0b01010 0b01010
}; };
void setup() { void setup() {
// initialize LCD and set up the number of columns and rows:
lcd.begin(16, 2);
// create a new character // create a new character
lcd.createChar(0, heart); lcd.createChar(0, heart);
// create a new character // create a new character
@ -108,11 +115,9 @@ void setup() {
// create a new character // create a new character
lcd.createChar(4, armsUp); lcd.createChar(4, armsUp);
// set up the lcd's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the lcd. // Print a message to the lcd.
lcd.print("I "); 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.print(" Arduino! ");
lcd.write(1); lcd.write(1);
@ -133,6 +138,3 @@ void loop() {
lcd.write(4); lcd.write(4);
delay(delayTime); delay(delayTime);
} }

View File

@ -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: The circuit:
* SD card attached to SPI bus as follows: * SD card attached to SPI bus as follows:
** MOSI - pin 11 ** MOSI - pin 11
@ -29,7 +31,6 @@ void setup()
; // wait for serial port to connect. Needed for Leonardo only ; // wait for serial port to connect. Needed for Leonardo only
} }
Serial.print("Initializing SD card..."); Serial.print("Initializing SD card...");
// On the Ethernet Shield, CS is pin 4. It's set as an output by default. // 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 // 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(); File entry = dir.openNextFile();
if (! entry) { if (! entry) {
// no more files // no more files
//Serial.println("**nomorefiles**");
break; break;
} }
for (uint8_t i=0; i<numTabs; i++) { for (uint8_t i=0; i<numTabs; i++) {