source: arduino-1-6-7/trunk/fuentes/arduino-ide-amd64/examples/01.Basics/AnalogReadSerial/AnalogReadSerial.ino @ 4837

Last change on this file since 4837 was 4837, checked in by daduve, 3 years ago

Adding new version

File size: 755 bytes
Line 
1/*
2  AnalogReadSerial
3  Reads an analog input on pin 0, prints the result to the serial monitor.
4  Graphical representation is available using serial plotter (Tools > Serial Plotter menu)
5  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
6
7  This example code is in the public domain.
8*/
9
10// the setup routine runs once when you press reset:
11void setup() {
12  // initialize serial communication at 9600 bits per second:
13  Serial.begin(9600);
14}
15
16// the loop routine runs over and over again forever:
17void loop() {
18  // read the input on analog pin 0:
19  int sensorValue = analogRead(A0);
20  // print out the value you read:
21  Serial.println(sensorValue);
22  delay(1);        // delay in between reads for stability
23}
Note: See TracBrowser for help on using the repository browser.