diff --git a/build/shared/examples/1.Basics/AnalogReadSerial/AnalogReadSerial.pde b/build/shared/examples/1.Basics/AnalogReadSerial/AnalogReadSerial.pde index 91dabdc24..97243f325 100644 --- a/build/shared/examples/1.Basics/AnalogReadSerial/AnalogReadSerial.pde +++ b/build/shared/examples/1.Basics/AnalogReadSerial/AnalogReadSerial.pde @@ -10,6 +10,6 @@ void setup() { } void loop() { - int sensorValue = analogRead(0); + int sensorValue = analogRead(A0); Serial.println(sensorValue, DEC); } diff --git a/build/shared/examples/1.Basics/Blink/Blink.pde b/build/shared/examples/1.Basics/Blink/Blink.pde index 16caa3c7a..1953c3908 100644 --- a/build/shared/examples/1.Basics/Blink/Blink.pde +++ b/build/shared/examples/1.Basics/Blink/Blink.pde @@ -6,7 +6,8 @@ */ void setup() { - // initialize the digital pin as an output: + // initialize the digital pin as an output. + // Pin 13 has an LED connected on most Arduino boards: pinMode(13, OUTPUT); } diff --git a/build/shared/examples/2.Digital/toneKeyboard/toneKeyboard.pde b/build/shared/examples/2.Digital/toneKeyboard/toneKeyboard.pde index 21eb1aed6..b1a5364a7 100644 --- a/build/shared/examples/2.Digital/toneKeyboard/toneKeyboard.pde +++ b/build/shared/examples/2.Digital/toneKeyboard/toneKeyboard.pde @@ -9,6 +9,7 @@ * 8-ohm speaker on digital pin 8 created 21 Jan 2010 + Modified 4 Sep 2010 by Tom Igoe This example code is in the public domain. diff --git a/build/shared/examples/2.Digital/tonePitchFollower/tonePitchFollower.pde b/build/shared/examples/2.Digital/tonePitchFollower/tonePitchFollower.pde index e91dc2d41..3b9d7387b 100644 --- a/build/shared/examples/2.Digital/tonePitchFollower/tonePitchFollower.pde +++ b/build/shared/examples/2.Digital/tonePitchFollower/tonePitchFollower.pde @@ -9,6 +9,7 @@ * 4.7K resistor on analog 0 to ground created 21 Jan 2010 + Modified 4 Sep 2010 by Tom Igoe This example code is in the public domain. @@ -25,7 +26,7 @@ void setup() { void loop() { // read the sensor: - int sensorReading = analogRead(0); + int sensorReading = analogRead(A0); // print the sensor reading so you know its range Serial.println(sensorReading); // map the pitch to the range of the analog input. diff --git a/build/shared/examples/3.Analog/AnalogInOutSerial/AnalogInOutSerial.pde b/build/shared/examples/3.Analog/AnalogInOutSerial/AnalogInOutSerial.pde index 0095e4b3d..57c14219d 100644 --- a/build/shared/examples/3.Analog/AnalogInOutSerial/AnalogInOutSerial.pde +++ b/build/shared/examples/3.Analog/AnalogInOutSerial/AnalogInOutSerial.pde @@ -12,6 +12,7 @@ * LED connected from digital pin 9 to ground created 29 Dec. 2008 + Modified 4 Sep 2010 by Tom Igoe This example code is in the public domain. @@ -20,7 +21,7 @@ // These constants won't change. They're used to give names // to the pins used: -const int analogInPin = 0; // Analog input pin that the potentiometer is attached to +const int analogInPin = A0; // Analog input pin that the potentiometer is attached to const int analogOutPin = 9; // Analog output pin that the LED is attached to int sensorValue = 0; // value read from the pot diff --git a/build/shared/examples/3.Analog/AnalogInSerial/AnalogInSerial.pde b/build/shared/examples/3.Analog/AnalogInSerial/AnalogInSerial.pde index f50480d44..bb01a208a 100644 --- a/build/shared/examples/3.Analog/AnalogInSerial/AnalogInSerial.pde +++ b/build/shared/examples/3.Analog/AnalogInSerial/AnalogInSerial.pde @@ -22,7 +22,7 @@ void loop() { // read the analog input into a variable: - int analogValue = analogRead(0); + int analogValue = analogRead(A0); // print the result: Serial.println(analogValue); // wait 10 milliseconds for the analog-to-digital converter diff --git a/build/shared/examples/3.Analog/AnalogInput/AnalogInput.pde b/build/shared/examples/3.Analog/AnalogInput/AnalogInput.pde index 20e56657f..18a005524 100644 --- a/build/shared/examples/3.Analog/AnalogInput/AnalogInput.pde +++ b/build/shared/examples/3.Analog/AnalogInput/AnalogInput.pde @@ -18,7 +18,7 @@ Created by David Cuartielles - Modified 16 Jun 2009 + Modified 4 Sep 2010 By Tom Igoe This example code is in the public domain. @@ -27,7 +27,7 @@ */ -int sensorPin = 0; // select the input pin for the potentiometer +int sensorPin = A0; // select the input pin for the potentiometer int ledPin = 13; // select the pin for the LED int sensorValue = 0; // variable to store the value coming from the sensor diff --git a/build/shared/examples/3.Analog/Calibration/Calibration.pde b/build/shared/examples/3.Analog/Calibration/Calibration.pde index 7788fd794..e8a1fe553 100644 --- a/build/shared/examples/3.Analog/Calibration/Calibration.pde +++ b/build/shared/examples/3.Analog/Calibration/Calibration.pde @@ -17,7 +17,7 @@ created 29 Oct 2008 By David A Mellis - Modified 17 Jun 2009 + Modified 4 Sep 2010 By Tom Igoe http://arduino.cc/en/Tutorial/Calibration @@ -27,7 +27,7 @@ */ // These constants won't change: -const int sensorPin = 0; // pin that the sensor is attached to +const int sensorPin = A0; // pin that the sensor is attached to const int ledPin = 9; // pin that the LED is attached to // variables: diff --git a/build/shared/examples/3.Analog/Smoothing/Smoothing.pde b/build/shared/examples/3.Analog/Smoothing/Smoothing.pde index 52ea2e369..5de30e8d7 100644 --- a/build/shared/examples/3.Analog/Smoothing/Smoothing.pde +++ b/build/shared/examples/3.Analog/Smoothing/Smoothing.pde @@ -31,7 +31,7 @@ int index = 0; // the index of the current reading int total = 0; // the running total int average = 0; // the average -int inputPin = 0; +int inputPin = A0; void setup() { diff --git a/build/shared/examples/4.Communication/Graph/Graph.pde b/build/shared/examples/4.Communication/Graph/Graph.pde index 69bc6838e..c1e39ac3f 100644 --- a/build/shared/examples/4.Communication/Graph/Graph.pde +++ b/build/shared/examples/4.Communication/Graph/Graph.pde @@ -33,7 +33,7 @@ void setup() { void loop() { // send the value of analog input 0: - Serial.println(analogRead(0)); + Serial.println(analogRead(A0)); // wait a bit for the analog-to-digital converter // to stabilize after the last reading: delay(10); diff --git a/build/shared/examples/4.Communication/SerialCallResponse/SerialCallResponse.pde b/build/shared/examples/4.Communication/SerialCallResponse/SerialCallResponse.pde index 2c8129c15..6f56d9891 100644 --- a/build/shared/examples/4.Communication/SerialCallResponse/SerialCallResponse.pde +++ b/build/shared/examples/4.Communication/SerialCallResponse/SerialCallResponse.pde @@ -15,7 +15,7 @@ Created 26 Sept. 2005 by Tom Igoe - Modified 14 April 2009 + Modified 4 Sep 2010 by Tom Igoe and Scott Fitzgerald This example code is in the public domain. @@ -44,7 +44,7 @@ void loop() // get incoming byte: inByte = Serial.read(); // read first analog input, divide by 4 to make the range 0-255: - firstSensor = analogRead(0)/4; + firstSensor = analogRead(A0)/4; // delay 10ms to let the ADC recover: delay(10); // read second analog input, divide by 4 to make the range 0-255: diff --git a/build/shared/examples/4.Communication/SerialCallResponseASCII/SerialCallResponseASCII.pde b/build/shared/examples/4.Communication/SerialCallResponseASCII/SerialCallResponseASCII.pde index c658c960e..3caf3f713 100644 --- a/build/shared/examples/4.Communication/SerialCallResponseASCII/SerialCallResponseASCII.pde +++ b/build/shared/examples/4.Communication/SerialCallResponseASCII/SerialCallResponseASCII.pde @@ -19,7 +19,7 @@ Created 26 Sept. 2005 by Tom Igoe - Modified 14 April 2009 + Modified 4 Sep 2010 by Tom Igoe and Scott Fitzgerald This example code is in the public domain. @@ -48,7 +48,7 @@ void loop() // get incoming byte: inByte = Serial.read(); // read first analog input, divide by 4 to make the range 0-255: - firstSensor = analogRead(0)/4; + firstSensor = analogRead(A0)/4; // delay 10ms to let the ADC recover: delay(10); // read second analog input, divide by 4 to make the range 0-255: diff --git a/build/shared/examples/4.Communication/VirtualColorMixer/VirtualColorMixer.pde b/build/shared/examples/4.Communication/VirtualColorMixer/VirtualColorMixer.pde index 9593c33af..5e8c4012a 100644 --- a/build/shared/examples/4.Communication/VirtualColorMixer/VirtualColorMixer.pde +++ b/build/shared/examples/4.Communication/VirtualColorMixer/VirtualColorMixer.pde @@ -10,15 +10,15 @@ created 2 Dec 2006 by David A. Mellis - modified 14 Apr 2009 + modified 4 Sep 2010 by Tom Igoe and Scott Fitzgerald This example code is in the public domain. */ -const int redPin = 0; // sensor to control red color -const int greenPin = 1; // sensor to control green color -const int bluePin = 2; // sensor to control blue color +const int redPin = A0; // sensor to control red color +const int greenPin = A1; // sensor to control green color +const int bluePin = A2; // sensor to control blue color void setup() { diff --git a/build/shared/examples/5.Control/IfStatementConditional/IfStatementConditional.pde b/build/shared/examples/5.Control/IfStatementConditional/IfStatementConditional.pde index e29166b41..5bc0dff3b 100644 --- a/build/shared/examples/5.Control/IfStatementConditional/IfStatementConditional.pde +++ b/build/shared/examples/5.Control/IfStatementConditional/IfStatementConditional.pde @@ -16,6 +16,7 @@ connected to pin 13, so you don't need any extra components for this example. created 17 Jan 2009 + modified 4 Sep 2010 by Tom Igoe This example code is in the public domain. @@ -25,7 +26,7 @@ http://arduino.cc/en/Tutorial/IfStatement */ // These constants won't change: -const int analogPin = 0; // pin that the sensor is attached to +const int analogPin = A0; // pin that the sensor is attached to const int ledPin = 13; // pin that the LED is attached to const int threshold = 400; // an arbitrary threshold level that's in the range of the analog input diff --git a/build/shared/examples/5.Control/WhileStatementConditional/WhileStatementConditional.pde b/build/shared/examples/5.Control/WhileStatementConditional/WhileStatementConditional.pde index 1c94d9326..69c6fc83b 100644 --- a/build/shared/examples/5.Control/WhileStatementConditional/WhileStatementConditional.pde +++ b/build/shared/examples/5.Control/WhileStatementConditional/WhileStatementConditional.pde @@ -17,7 +17,7 @@ * 10K resistor attached from pin 2 to ground created 17 Jan 2009 - modified 25 Jun 2009 + modified 4 Sep 2010 by Tom Igoe This example code is in the public domain. @@ -28,10 +28,10 @@ // These constants won't change: -const int sensorPin = 2; // pin that the sensor is attached to -const int ledPin = 9; // pin that the LED is attached to -const int indicatorLedPin = 13; // pin that the built-in LED is attached to -const int buttonPin = 2; // pin that the button is attached to +const int sensorPin = A2; // pin that the sensor is attached to +const int ledPin = 9; // pin that the LED is attached to +const int indicatorLedPin = 13; // pin that the built-in LED is attached to +const int buttonPin = 2; // pin that the button is attached to // These variables will change: diff --git a/build/shared/examples/5.Control/switchCase/switchCase.pde b/build/shared/examples/5.Control/switchCase/switchCase.pde index 17809125a..1b76e5fb6 100644 --- a/build/shared/examples/5.Control/switchCase/switchCase.pde +++ b/build/shared/examples/5.Control/switchCase/switchCase.pde @@ -14,6 +14,7 @@ * 10K resistor from analog in 0 to ground created 1 Jul 2009 + modified 4 Sep 2010 by Tom Igoe This example code is in the public domain. @@ -32,7 +33,7 @@ void setup() { void loop() { // read the sensor: - int sensorReading = analogRead(0); + int sensorReading = analogRead(A0); // map the sensor range to a range of four options: int range = map(sensorReading, sensorMin, sensorMax, 0, 3); diff --git a/build/shared/examples/6.Sensors/ADXL3xx/ADXL3xx.pde b/build/shared/examples/6.Sensors/ADXL3xx/ADXL3xx.pde index 4e495868e..58ea129d2 100644 --- a/build/shared/examples/6.Sensors/ADXL3xx/ADXL3xx.pde +++ b/build/shared/examples/6.Sensors/ADXL3xx/ADXL3xx.pde @@ -19,7 +19,7 @@ created 2 Jul 2008 by David A. Mellis - modified 26 Jun 2009 + modified 4 Sep 2010 by Tom Igoe This example code is in the public domain. @@ -29,9 +29,9 @@ // these constants describe the pins. They won't change: const int groundpin = 18; // analog input pin 4 -- ground const int powerpin = 19; // analog input pin 5 -- voltage -const int xpin = 3; // x-axis of the accelerometer -const int ypin = 2; // y-axis -const int zpin = 1; // z-axis (only on 3-axis models) +const int xpin = A3; // x-axis of the accelerometer +const int ypin = A2; // y-axis +const int zpin = A1; // z-axis (only on 3-axis models) void setup() { diff --git a/build/shared/examples/6.Sensors/Knock/Knock.pde b/build/shared/examples/6.Sensors/Knock/Knock.pde index bdb557e2f..985f032b9 100644 --- a/build/shared/examples/6.Sensors/Knock/Knock.pde +++ b/build/shared/examples/6.Sensors/Knock/Knock.pde @@ -14,7 +14,7 @@ created 25 Mar 2007 by David Cuartielles - modified 30 Jun 2009 + modified 4 Sep 2010 by Tom Igoe This example code is in the public domain. @@ -24,7 +24,7 @@ // these constants won't change: const int ledPin = 13; // led connected to digital pin 13 -const int knockSensor = 0; // the piezo is connected to analog pin 0 +const int knockSensor = A0; // the piezo is connected to analog pin 0 const int threshold = 100; // threshold value to decide when the detected sound is a knock or not diff --git a/build/shared/examples/7.Display/RowColumnScanning/RowColumnScanning.pde b/build/shared/examples/7.Display/RowColumnScanning/RowColumnScanning.pde index ebfe8f5cb..bcda4c78d 100644 --- a/build/shared/examples/7.Display/RowColumnScanning/RowColumnScanning.pde +++ b/build/shared/examples/7.Display/RowColumnScanning/RowColumnScanning.pde @@ -4,7 +4,7 @@ This example controls an 8x8 LED matrix using two analog inputs created 27 May 2009 - modified 29 Jun 2009 + modified 4 Sep 2010 by Tom Igoe This example works for the Lumex LDM-24488NI Matrix. See @@ -83,8 +83,8 @@ void readSensors() { // turn off the last position: pixels[x][y] = HIGH; // read the sensors for X and Y values: - x = 7 - map(analogRead(0), 0, 1023, 0, 7); - y = map(analogRead(1), 0, 1023, 0, 7); + x = 7 - map(analogRead(A0), 0, 1023, 0, 7); + y = map(analogRead(A1), 0, 1023, 0, 7); // set the new pixel position low so that the LED will turn on // in the next screen refresh: pixels[x][y] = LOW; diff --git a/build/shared/examples/7.Display/barGraph/barGraph.pde b/build/shared/examples/7.Display/barGraph/barGraph.pde index a3de3c192..646cd4744 100644 --- a/build/shared/examples/7.Display/barGraph/barGraph.pde +++ b/build/shared/examples/7.Display/barGraph/barGraph.pde @@ -12,7 +12,7 @@ The circuit: * LEDs from pins 2 through 11 to ground - created 26 Jun 2009 + created 4 Sep 2010 by Tom Igoe This example code is in the public domain. @@ -22,7 +22,7 @@ // these constants won't change: -const int analogPin = 0; // the pin that the potentiometer is attached to +const int analogPin = A0; // the pin that the potentiometer is attached to const int ledCount = 10; // the number of LEDs in the bar graph int ledPins[] = { diff --git a/build/shared/examples/8.Strings/StringAdditionOperator/StringAdditionOperator.pde b/build/shared/examples/8.Strings/StringAdditionOperator/StringAdditionOperator.pde index 15431e22f..fe631b9c7 100644 --- a/build/shared/examples/8.Strings/StringAdditionOperator/StringAdditionOperator.pde +++ b/build/shared/examples/8.Strings/StringAdditionOperator/StringAdditionOperator.pde @@ -5,6 +5,7 @@ You can also add several different data types to string, as shown here: created 27 July 2010 + modified 4 Sep 2010 by Tom Igoe http://arduino.cc/en/Tutorial/StringAdditionOperator @@ -44,10 +45,10 @@ void loop() { Serial.println(stringThree); // prints "You added this string" // adding a variable integer to a string: - int sensorValue = analogRead(0); + int sensorValue = analogRead(A0); stringOne = "Sensor value: "; stringThree = stringOne + sensorValue; - Serial.println(stringThree); // prints "Sensor Value: 401" or whatever value analogRead(0) has + Serial.println(stringThree); // prints "Sensor Value: 401" or whatever value analogRead(A0) has // adding a variable long integer to a string: long currentTime = millis(); diff --git a/build/shared/examples/8.Strings/StringAppendOperator/StringAppendOperator.pde b/build/shared/examples/8.Strings/StringAppendOperator/StringAppendOperator.pde index d4cb5db6f..680738142 100644 --- a/build/shared/examples/8.Strings/StringAppendOperator/StringAppendOperator.pde +++ b/build/shared/examples/8.Strings/StringAppendOperator/StringAppendOperator.pde @@ -4,6 +4,7 @@ Examples of how to append different data types to strings created 27 July 2010 + modified 4 Sep 2010 by Tom Igoe http://arduino.cc/en/Tutorial/StringAppendOperator @@ -43,8 +44,8 @@ void loop() { Serial.println(stringOne); // prints "Sensor value for input" // adding a variable integer to a string: - stringOne += analogRead(0); - Serial.println(stringOne); // prints "Sensor value for input A0: 456" or whatever analogRead(0) is + stringOne += analogRead(A0); + Serial.println(stringOne); // prints "Sensor value for input A0: 456" or whatever analogRead(A0) is Serial.println("\n\nchanging the Strings' values"); stringOne = "A long integer: "; diff --git a/build/shared/examples/8.Strings/StringComparisonOperators/StringComparisonOperators.pde b/build/shared/examples/8.Strings/StringComparisonOperators/StringComparisonOperators.pde index bd47ab429..ff7fe68a3 100644 --- a/build/shared/examples/8.Strings/StringComparisonOperators/StringComparisonOperators.pde +++ b/build/shared/examples/8.Strings/StringComparisonOperators/StringComparisonOperators.pde @@ -4,6 +4,7 @@ Examples of how to compare strings using the comparison operators created 27 July 2010 + modified 4 Sep 2010 by Tom Igoe http://arduino.cc/en/Tutorial/StringComparisonOperators @@ -109,8 +110,8 @@ void loop() { stringOne = "Sensor: "; stringTwo= "Sensor: "; - stringOne += analogRead(0); - stringTwo += analogRead(5); + stringOne += analogRead(A0); + stringTwo += analogRead(A5); if (stringOne.compareTo(stringTwo) < 0 ) { Serial.println(stringOne + " comes after " + stringTwo); diff --git a/build/shared/examples/8.Strings/StringConstructors/StringConstructors.pde b/build/shared/examples/8.Strings/StringConstructors/StringConstructors.pde index fd79ecc98..94ae2dc7a 100644 --- a/build/shared/examples/8.Strings/StringConstructors/StringConstructors.pde +++ b/build/shared/examples/8.Strings/StringConstructors/StringConstructors.pde @@ -4,6 +4,7 @@ Examples of how to create strings from other data types created 27 July 2010 + modified 4 Sep 2010 by Tom Igoe http://arduino.cc/en/Tutorial/StringConstructors @@ -38,8 +39,8 @@ void loop() { Serial.println(stringOne); // prints "13" // using an int and a base: - stringOne = String(analogRead(0), DEC); - // prints "453" or whatever the value of analogRead(0) is + stringOne = String(analogRead(A0), DEC); + // prints "453" or whatever the value of analogRead(A0) is Serial.println(stringOne); // using an int and a base (hexadecimal): diff --git a/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.pde b/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.pde index 1b1aa6925..b18b67684 100644 --- a/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.pde +++ b/build/shared/examples/8.Strings/StringStartsWithEndsWith/StringStartsWithEndsWith.pde @@ -4,6 +4,7 @@ Examples of how to use startsWith() and endsWith() in a String created 27 July 2010 + modified 4 Sep 2010 by Tom Igoe http://arduino.cc/en/Tutorial/StringStartsWithEndsWith @@ -33,7 +34,7 @@ void loop() { // endsWith() checks to see if a String ends with a particular character: String sensorReading = "sensor = "; - sensorReading += analogRead(0); + sensorReading += analogRead(A0); Serial.print (sensorReading); if (sensorReading.endsWith(0)) { Serial.println(". This reading is divisible by ten");