# Source: https://learn.adafruit.com/adafruit-arduino-lesson-15-dc-motor-reversing/an-experiment.md

# Source: https://learn.adafruit.com/adafruit-arduino-lesson-8-analog-inputs/an-experiment.md

# Arduino Lesson 8. Analog Inputs

## An Experiment

Before we go ahead and use the LEDs, you can try a little experiment using just the variable resistor also known as a&nbsp; **potentiometer** (often called a 'pot' for short) and the Arduino Serial Monitor.

Connect up your breadboard as shown below:

![](https://cdn-learn.adafruit.com/assets/assets/000/002/248/medium800/learn_arduino_breadboard_1.jpg?1396780899)

Load the following sketch onto your Arduino.

```
/*
Adafruit Arduino - Lesson 8. Analog Inputs
*/

int potPin = 0;

void setup() 
{
  Serial.begin(9600);
}

void loop() 
{
  int reading  = analogRead(potPin);
  Serial.println(reading);
  delay(500);
}
```

Now open the Serial Monitor, and you will see a stream of numbers appearing.

![](https://cdn-learn.adafruit.com/assets/assets/000/002/249/medium800/learn_arduino_serial_monitor.jpg?1396780907)

Turn the knob on the variable resistor and you will see the number change between 0 and 1023.

The Serial Monitor is displaying the analog reading value from A0 using the line:

```
 int reading  = analogRead(potPin);
```

The voltage at A0 is being transformed into a number between 0 and 1023.

- [Previous Page](https://learn.adafruit.com/adafruit-arduino-lesson-8-analog-inputs/parts.md)
- [Next Page](https://learn.adafruit.com/adafruit-arduino-lesson-8-analog-inputs/variable-resistors-pots.md)

## Featured Products

### Breadboard trim potentiometer

[Breadboard trim potentiometer](https://www.adafruit.com/product/356)
These are our favorite trim pots, perfect for breadboarding and prototyping. They have a long grippy adjustment knob and with 0.1" spacing, they plug into breadboards or perfboards with ease.

This is the same pot that comes with our character LCDs and tutorial...

In Stock
[Buy Now](https://www.adafruit.com/product/356)
[Related Guides to the Product](https://learn.adafruit.com/products/356/guides)
### Diffused Red 5mm LED (25 pack)

[Diffused Red 5mm LED (25 pack)](https://www.adafruit.com/product/299)
Need some indicators? We are big fans of these diffused red LEDs, in fact we use them exclusively in our kits. They are fairly bright so they can be seen in daytime, and from any angle. They go easily into a breadboard and will add that extra zing to your project.

- Pack of 25...

In Stock
[Buy Now](https://www.adafruit.com/product/299)
[Related Guides to the Product](https://learn.adafruit.com/products/299/guides)
### 74HC595 Shift Register - 3 pack

[74HC595 Shift Register - 3 pack](https://www.adafruit.com/product/450)
Add lots more outputs to a microcontroller system with chainable shift registers. These chips take a serial input (SPI) of 1 byte (8 bits) and then output those digital bits onto 8 pins. You can chain them together so putting three in a row with the serial output of one plugged into the serial...

In Stock
[Buy Now](https://www.adafruit.com/product/450)
[Related Guides to the Product](https://learn.adafruit.com/products/450/guides)
### Premium Male/Male Jumper Wires - 40 x 6" (150mm)

[Premium Male/Male Jumper Wires - 40 x 6" (150mm)](https://www.adafruit.com/product/758)
Handy for making wire harnesses or jumpering between headers on PCB's. These premium jumper wires are 6" (150mm) long and come in a 'strip' of 40 (4 pieces of each of ten rainbow colors). They have 0.1" male header contacts on either end and fit cleanly next to each other...

In Stock
[Buy Now](https://www.adafruit.com/product/758)
[Related Guides to the Product](https://learn.adafruit.com/products/758/guides)
### Half Sized Premium Breadboard - 400 Tie Points

[Half Sized Premium Breadboard - 400 Tie Points](https://www.adafruit.com/product/64)
This is a cute, half-size breadboard with&nbsp;400 tie points, good for small projects. It's 3.25" x 2.2" / 8.3cm&nbsp;x 5.5cm&nbsp;with a standard double-strip in the middle and two power rails on both sides.&nbsp;You can pull the power rails off easily to make the breadboard as...

In Stock
[Buy Now](https://www.adafruit.com/product/64)
[Related Guides to the Product](https://learn.adafruit.com/products/64/guides)
### Adafruit METRO 328 Fully Assembled - Arduino IDE compatible

[Adafruit METRO 328 Fully Assembled - Arduino IDE compatible](https://www.adafruit.com/product/50)
We sure love the ATmega328 here at Adafruit, and we use them&nbsp;_a lot_&nbsp;for our own projects. The processor has plenty of GPIO, Analog inputs, hardware UART SPI and I2C, timers and PWM galore - just enough for most simple projects. When we need to go small, we use a <a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/50)
[Related Guides to the Product](https://learn.adafruit.com/products/50/guides)

## Related Guides

- [74HC595 Shift Register](https://learn.adafruit.com/74hc595.md)
- [8BitBox](https://learn.adafruit.com/8bitbox.md)
- [Adafruit Data Logger Shield](https://learn.adafruit.com/adafruit-data-logger-shield.md)
- [Adafruit Music Maker Shield](https://learn.adafruit.com/adafruit-music-maker-shield-vs1053-mp3-wav-wave-ogg-vorbis-player.md)
- [Adalight Project Pack](https://learn.adafruit.com/adalight-diy-ambient-tv-lighting.md)
- [OLED TRON Clock](https://learn.adafruit.com/oled-tron-clock.md)
- [Arduino "Hunt The Wumpus"](https://learn.adafruit.com/arduino-hunt-the-wumpus.md)
- [Arduino Tips, Tricks, and Techniques](https://learn.adafruit.com/arduino-tips-tricks-and-techniques.md)
- [NeoPixel Painter](https://learn.adafruit.com/neopixel-painter.md)
- [1,500 NeoPixel LED Curtain with Raspberry Pi and Fadecandy](https://learn.adafruit.com/1500-neopixel-led-curtain-with-raspberry-pi-fadecandy.md)
- [Arduin-o-Phone](https://learn.adafruit.com/arduin-o-phone-arduino-powered-diy-cellphone.md)
- [LED Lightbox](https://learn.adafruit.com/led-lightbox.md)
- [Arduino Lesson 3. RGB LEDs](https://learn.adafruit.com/adafruit-arduino-lesson-3-rgb-leds.md)
- [Wave Shield](https://learn.adafruit.com/adafruit-wave-shield-audio-shield-for-arduino.md)
- [Making Adabot: Part 2](https://learn.adafruit.com/making-adabot-part-2.md)
- [RePaper eInk Development Board](https://learn.adafruit.com/repaper-eink-development-board.md)