-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
AnalogReadSerial | ||
Reads an analog input on pin 0, prints the result to the Serial Monitor. | ||
Graphical representation is available using Serial Plotter (Tools > Serial Plotter menu). | ||
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground. | ||
This example code is in the public domain. | ||
https://www.arduino.cc/en/Tutorial/BuiltInExamples/AnalogReadSerial | ||
*/ | ||
|
||
// the setup routine runs once when you press reset: | ||
void setup() { | ||
// initialize serial communication at 9600 bits per second: | ||
Serial.begin(115200); | ||
} | ||
|
||
// the loop routine runs over and over again forever: | ||
void loop() { | ||
// read the input on analog pin 0: | ||
int sensorValue = analogRead(A0); | ||
// print out the value you read: | ||
Serial.print(sensorValue); | ||
delay(1); // delay in between reads for stability | ||
} |