mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Changed analog references to use new A0 through A5 notation
This commit is contained in:
@ -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();
|
||||
|
@ -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: ";
|
||||
|
@ -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);
|
||||
|
@ -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):
|
||||
|
@ -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");
|
||||
|
Reference in New Issue
Block a user