mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
Changed analog references to use new A0 through A5 notation
This commit is contained in:
parent
5e2f82b742
commit
47d3b65e51
@ -10,6 +10,6 @@ void setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
int sensorValue = analogRead(0);
|
int sensorValue = analogRead(A0);
|
||||||
Serial.println(sensorValue, DEC);
|
Serial.println(sensorValue, DEC);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void setup() {
|
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);
|
pinMode(13, OUTPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
* 8-ohm speaker on digital pin 8
|
* 8-ohm speaker on digital pin 8
|
||||||
|
|
||||||
created 21 Jan 2010
|
created 21 Jan 2010
|
||||||
|
Modified 4 Sep 2010
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
* 4.7K resistor on analog 0 to ground
|
* 4.7K resistor on analog 0 to ground
|
||||||
|
|
||||||
created 21 Jan 2010
|
created 21 Jan 2010
|
||||||
|
Modified 4 Sep 2010
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
@ -25,7 +26,7 @@ void setup() {
|
|||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// read the sensor:
|
// read the sensor:
|
||||||
int sensorReading = analogRead(0);
|
int sensorReading = analogRead(A0);
|
||||||
// print the sensor reading so you know its range
|
// print the sensor reading so you know its range
|
||||||
Serial.println(sensorReading);
|
Serial.println(sensorReading);
|
||||||
// map the pitch to the range of the analog input.
|
// map the pitch to the range of the analog input.
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
* LED connected from digital pin 9 to ground
|
* LED connected from digital pin 9 to ground
|
||||||
|
|
||||||
created 29 Dec. 2008
|
created 29 Dec. 2008
|
||||||
|
Modified 4 Sep 2010
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
@ -20,7 +21,7 @@
|
|||||||
|
|
||||||
// These constants won't change. They're used to give names
|
// These constants won't change. They're used to give names
|
||||||
// to the pins used:
|
// 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
|
const int analogOutPin = 9; // Analog output pin that the LED is attached to
|
||||||
|
|
||||||
int sensorValue = 0; // value read from the pot
|
int sensorValue = 0; // value read from the pot
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// read the analog input into a variable:
|
// read the analog input into a variable:
|
||||||
int analogValue = analogRead(0);
|
int analogValue = analogRead(A0);
|
||||||
// print the result:
|
// print the result:
|
||||||
Serial.println(analogValue);
|
Serial.println(analogValue);
|
||||||
// wait 10 milliseconds for the analog-to-digital converter
|
// wait 10 milliseconds for the analog-to-digital converter
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
|
|
||||||
Created by David Cuartielles
|
Created by David Cuartielles
|
||||||
Modified 16 Jun 2009
|
Modified 4 Sep 2010
|
||||||
By Tom Igoe
|
By Tom Igoe
|
||||||
|
|
||||||
This example code is in the public domain.
|
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 ledPin = 13; // select the pin for the LED
|
||||||
int sensorValue = 0; // variable to store the value coming from the sensor
|
int sensorValue = 0; // variable to store the value coming from the sensor
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
created 29 Oct 2008
|
created 29 Oct 2008
|
||||||
By David A Mellis
|
By David A Mellis
|
||||||
Modified 17 Jun 2009
|
Modified 4 Sep 2010
|
||||||
By Tom Igoe
|
By Tom Igoe
|
||||||
|
|
||||||
http://arduino.cc/en/Tutorial/Calibration
|
http://arduino.cc/en/Tutorial/Calibration
|
||||||
@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// These constants won't change:
|
// 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
|
const int ledPin = 9; // pin that the LED is attached to
|
||||||
|
|
||||||
// variables:
|
// variables:
|
||||||
|
@ -31,7 +31,7 @@ int index = 0; // the index of the current reading
|
|||||||
int total = 0; // the running total
|
int total = 0; // the running total
|
||||||
int average = 0; // the average
|
int average = 0; // the average
|
||||||
|
|
||||||
int inputPin = 0;
|
int inputPin = A0;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ void setup() {
|
|||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// send the value of analog input 0:
|
// send the value of analog input 0:
|
||||||
Serial.println(analogRead(0));
|
Serial.println(analogRead(A0));
|
||||||
// wait a bit for the analog-to-digital converter
|
// wait a bit for the analog-to-digital converter
|
||||||
// to stabilize after the last reading:
|
// to stabilize after the last reading:
|
||||||
delay(10);
|
delay(10);
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
Created 26 Sept. 2005
|
Created 26 Sept. 2005
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
Modified 14 April 2009
|
Modified 4 Sep 2010
|
||||||
by Tom Igoe and Scott Fitzgerald
|
by Tom Igoe and Scott Fitzgerald
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
@ -44,7 +44,7 @@ void loop()
|
|||||||
// get incoming byte:
|
// get incoming byte:
|
||||||
inByte = Serial.read();
|
inByte = Serial.read();
|
||||||
// read first analog input, divide by 4 to make the range 0-255:
|
// 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 10ms to let the ADC recover:
|
||||||
delay(10);
|
delay(10);
|
||||||
// read second analog input, divide by 4 to make the range 0-255:
|
// read second analog input, divide by 4 to make the range 0-255:
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
Created 26 Sept. 2005
|
Created 26 Sept. 2005
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
Modified 14 April 2009
|
Modified 4 Sep 2010
|
||||||
by Tom Igoe and Scott Fitzgerald
|
by Tom Igoe and Scott Fitzgerald
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
@ -48,7 +48,7 @@ void loop()
|
|||||||
// get incoming byte:
|
// get incoming byte:
|
||||||
inByte = Serial.read();
|
inByte = Serial.read();
|
||||||
// read first analog input, divide by 4 to make the range 0-255:
|
// 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 10ms to let the ADC recover:
|
||||||
delay(10);
|
delay(10);
|
||||||
// read second analog input, divide by 4 to make the range 0-255:
|
// read second analog input, divide by 4 to make the range 0-255:
|
||||||
|
@ -10,15 +10,15 @@
|
|||||||
|
|
||||||
created 2 Dec 2006
|
created 2 Dec 2006
|
||||||
by David A. Mellis
|
by David A. Mellis
|
||||||
modified 14 Apr 2009
|
modified 4 Sep 2010
|
||||||
by Tom Igoe and Scott Fitzgerald
|
by Tom Igoe and Scott Fitzgerald
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const int redPin = 0; // sensor to control red color
|
const int redPin = A0; // sensor to control red color
|
||||||
const int greenPin = 1; // sensor to control green color
|
const int greenPin = A1; // sensor to control green color
|
||||||
const int bluePin = 2; // sensor to control blue color
|
const int bluePin = A2; // sensor to control blue color
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
connected to pin 13, so you don't need any extra components for this example.
|
connected to pin 13, so you don't need any extra components for this example.
|
||||||
|
|
||||||
created 17 Jan 2009
|
created 17 Jan 2009
|
||||||
|
modified 4 Sep 2010
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
@ -25,7 +26,7 @@ http://arduino.cc/en/Tutorial/IfStatement
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// These constants won't change:
|
// 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 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
|
const int threshold = 400; // an arbitrary threshold level that's in the range of the analog input
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* 10K resistor attached from pin 2 to ground
|
* 10K resistor attached from pin 2 to ground
|
||||||
|
|
||||||
created 17 Jan 2009
|
created 17 Jan 2009
|
||||||
modified 25 Jun 2009
|
modified 4 Sep 2010
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// These constants won't change:
|
// These constants won't change:
|
||||||
const int sensorPin = 2; // pin that the sensor 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 ledPin = 9; // pin that the LED is attached to
|
||||||
const int indicatorLedPin = 13; // pin that the built-in 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 buttonPin = 2; // pin that the button is attached to
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
* 10K resistor from analog in 0 to ground
|
* 10K resistor from analog in 0 to ground
|
||||||
|
|
||||||
created 1 Jul 2009
|
created 1 Jul 2009
|
||||||
|
modified 4 Sep 2010
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
@ -32,7 +33,7 @@ void setup() {
|
|||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// read the sensor:
|
// read the sensor:
|
||||||
int sensorReading = analogRead(0);
|
int sensorReading = analogRead(A0);
|
||||||
// map the sensor range to a range of four options:
|
// map the sensor range to a range of four options:
|
||||||
int range = map(sensorReading, sensorMin, sensorMax, 0, 3);
|
int range = map(sensorReading, sensorMin, sensorMax, 0, 3);
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
created 2 Jul 2008
|
created 2 Jul 2008
|
||||||
by David A. Mellis
|
by David A. Mellis
|
||||||
modified 26 Jun 2009
|
modified 4 Sep 2010
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
@ -29,9 +29,9 @@
|
|||||||
// these constants describe the pins. They won't change:
|
// these constants describe the pins. They won't change:
|
||||||
const int groundpin = 18; // analog input pin 4 -- ground
|
const int groundpin = 18; // analog input pin 4 -- ground
|
||||||
const int powerpin = 19; // analog input pin 5 -- voltage
|
const int powerpin = 19; // analog input pin 5 -- voltage
|
||||||
const int xpin = 3; // x-axis of the accelerometer
|
const int xpin = A3; // x-axis of the accelerometer
|
||||||
const int ypin = 2; // y-axis
|
const int ypin = A2; // y-axis
|
||||||
const int zpin = 1; // z-axis (only on 3-axis models)
|
const int zpin = A1; // z-axis (only on 3-axis models)
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
created 25 Mar 2007
|
created 25 Mar 2007
|
||||||
by David Cuartielles <http://www.0j0.org>
|
by David Cuartielles <http://www.0j0.org>
|
||||||
modified 30 Jun 2009
|
modified 4 Sep 2010
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
// these constants won't change:
|
// these constants won't change:
|
||||||
const int ledPin = 13; // led connected to digital pin 13
|
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
|
const int threshold = 100; // threshold value to decide when the detected sound is a knock or not
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
This example controls an 8x8 LED matrix using two analog inputs
|
This example controls an 8x8 LED matrix using two analog inputs
|
||||||
|
|
||||||
created 27 May 2009
|
created 27 May 2009
|
||||||
modified 29 Jun 2009
|
modified 4 Sep 2010
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
This example works for the Lumex LDM-24488NI Matrix. See
|
This example works for the Lumex LDM-24488NI Matrix. See
|
||||||
@ -83,8 +83,8 @@ void readSensors() {
|
|||||||
// turn off the last position:
|
// turn off the last position:
|
||||||
pixels[x][y] = HIGH;
|
pixels[x][y] = HIGH;
|
||||||
// read the sensors for X and Y values:
|
// read the sensors for X and Y values:
|
||||||
x = 7 - map(analogRead(0), 0, 1023, 0, 7);
|
x = 7 - map(analogRead(A0), 0, 1023, 0, 7);
|
||||||
y = map(analogRead(1), 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
|
// set the new pixel position low so that the LED will turn on
|
||||||
// in the next screen refresh:
|
// in the next screen refresh:
|
||||||
pixels[x][y] = LOW;
|
pixels[x][y] = LOW;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
The circuit:
|
The circuit:
|
||||||
* LEDs from pins 2 through 11 to ground
|
* LEDs from pins 2 through 11 to ground
|
||||||
|
|
||||||
created 26 Jun 2009
|
created 4 Sep 2010
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// these constants won't change:
|
// 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
|
const int ledCount = 10; // the number of LEDs in the bar graph
|
||||||
|
|
||||||
int ledPins[] = {
|
int ledPins[] = {
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
You can also add several different data types to string, as shown here:
|
You can also add several different data types to string, as shown here:
|
||||||
|
|
||||||
created 27 July 2010
|
created 27 July 2010
|
||||||
|
modified 4 Sep 2010
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
http://arduino.cc/en/Tutorial/StringAdditionOperator
|
http://arduino.cc/en/Tutorial/StringAdditionOperator
|
||||||
@ -44,10 +45,10 @@ void loop() {
|
|||||||
Serial.println(stringThree); // prints "You added this string"
|
Serial.println(stringThree); // prints "You added this string"
|
||||||
|
|
||||||
// adding a variable integer to a string:
|
// adding a variable integer to a string:
|
||||||
int sensorValue = analogRead(0);
|
int sensorValue = analogRead(A0);
|
||||||
stringOne = "Sensor value: ";
|
stringOne = "Sensor value: ";
|
||||||
stringThree = stringOne + sensorValue;
|
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:
|
// adding a variable long integer to a string:
|
||||||
long currentTime = millis();
|
long currentTime = millis();
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
Examples of how to append different data types to strings
|
Examples of how to append different data types to strings
|
||||||
|
|
||||||
created 27 July 2010
|
created 27 July 2010
|
||||||
|
modified 4 Sep 2010
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
http://arduino.cc/en/Tutorial/StringAppendOperator
|
http://arduino.cc/en/Tutorial/StringAppendOperator
|
||||||
@ -43,8 +44,8 @@ void loop() {
|
|||||||
Serial.println(stringOne); // prints "Sensor value for input"
|
Serial.println(stringOne); // prints "Sensor value for input"
|
||||||
|
|
||||||
// adding a variable integer to a string:
|
// adding a variable integer to a string:
|
||||||
stringOne += analogRead(0);
|
stringOne += analogRead(A0);
|
||||||
Serial.println(stringOne); // prints "Sensor value for input A0: 456" or whatever analogRead(0) is
|
Serial.println(stringOne); // prints "Sensor value for input A0: 456" or whatever analogRead(A0) is
|
||||||
|
|
||||||
Serial.println("\n\nchanging the Strings' values");
|
Serial.println("\n\nchanging the Strings' values");
|
||||||
stringOne = "A long integer: ";
|
stringOne = "A long integer: ";
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
Examples of how to compare strings using the comparison operators
|
Examples of how to compare strings using the comparison operators
|
||||||
|
|
||||||
created 27 July 2010
|
created 27 July 2010
|
||||||
|
modified 4 Sep 2010
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
http://arduino.cc/en/Tutorial/StringComparisonOperators
|
http://arduino.cc/en/Tutorial/StringComparisonOperators
|
||||||
@ -109,8 +110,8 @@ void loop() {
|
|||||||
stringOne = "Sensor: ";
|
stringOne = "Sensor: ";
|
||||||
stringTwo= "Sensor: ";
|
stringTwo= "Sensor: ";
|
||||||
|
|
||||||
stringOne += analogRead(0);
|
stringOne += analogRead(A0);
|
||||||
stringTwo += analogRead(5);
|
stringTwo += analogRead(A5);
|
||||||
|
|
||||||
if (stringOne.compareTo(stringTwo) < 0 ) {
|
if (stringOne.compareTo(stringTwo) < 0 ) {
|
||||||
Serial.println(stringOne + " comes after " + stringTwo);
|
Serial.println(stringOne + " comes after " + stringTwo);
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
Examples of how to create strings from other data types
|
Examples of how to create strings from other data types
|
||||||
|
|
||||||
created 27 July 2010
|
created 27 July 2010
|
||||||
|
modified 4 Sep 2010
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
http://arduino.cc/en/Tutorial/StringConstructors
|
http://arduino.cc/en/Tutorial/StringConstructors
|
||||||
@ -38,8 +39,8 @@ void loop() {
|
|||||||
Serial.println(stringOne); // prints "13"
|
Serial.println(stringOne); // prints "13"
|
||||||
|
|
||||||
// using an int and a base:
|
// using an int and a base:
|
||||||
stringOne = String(analogRead(0), DEC);
|
stringOne = String(analogRead(A0), DEC);
|
||||||
// prints "453" or whatever the value of analogRead(0) is
|
// prints "453" or whatever the value of analogRead(A0) is
|
||||||
Serial.println(stringOne);
|
Serial.println(stringOne);
|
||||||
|
|
||||||
// using an int and a base (hexadecimal):
|
// using an int and a base (hexadecimal):
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
Examples of how to use startsWith() and endsWith() in a String
|
Examples of how to use startsWith() and endsWith() in a String
|
||||||
|
|
||||||
created 27 July 2010
|
created 27 July 2010
|
||||||
|
modified 4 Sep 2010
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
http://arduino.cc/en/Tutorial/StringStartsWithEndsWith
|
http://arduino.cc/en/Tutorial/StringStartsWithEndsWith
|
||||||
@ -33,7 +34,7 @@ void loop() {
|
|||||||
|
|
||||||
// endsWith() checks to see if a String ends with a particular character:
|
// endsWith() checks to see if a String ends with a particular character:
|
||||||
String sensorReading = "sensor = ";
|
String sensorReading = "sensor = ";
|
||||||
sensorReading += analogRead(0);
|
sensorReading += analogRead(A0);
|
||||||
Serial.print (sensorReading);
|
Serial.print (sensorReading);
|
||||||
if (sensorReading.endsWith(0)) {
|
if (sensorReading.endsWith(0)) {
|
||||||
Serial.println(". This reading is divisible by ten");
|
Serial.println(". This reading is divisible by ten");
|
||||||
|
Loading…
Reference in New Issue
Block a user