> For the complete documentation index, see [llms.txt](https://cavedu.gitbook.io/linkit-7697/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cavedu.gitbook.io/linkit-7697/linkit-7697-development-guide-for-arduino-ide/developer-guide/adc.md).

# ADC

The Analog-to-Digital (ADC) convertion pins allows you to read input voltages as integers with **Analog Pins** on the [pin-out diagram](https://labs.mediatek.com/en/download/1ega2lbl).

Please note the following before using the analog pins on LinkIt 7697:

1. The ADC input voltage ranges from 0 to **2.5V** - not 3.3V.
2. The ADC has **12-bit** resolution, so the output value of `analogRead()` ranges from **0 to 4095**.
3. The input impedance of ADC pins is **10k Ohm.**
4. In Arduino IDE, **A0** maps to **ADC\_IN0** on the pin-out diagram. Check the table below for quick reference:

|                           |                |          |
| ------------------------- | -------------- | -------- |
| Silkscreen printing Pin # | Arduino Symbol | MT7697   |
| P14                       | A0             | ADC\_IN0 |
| P15                       | A1             | ADC\_IN1 |
| P16                       | A2             | ADC\_IN2 |
| P17                       | A3             | ADC\_IN3 |

To demonstrate this, upload and run the IDE example sketch **File > Examples > 03. Analog > AnalogInput**. You need to modify the sketch to make it fit the specs of LinkIt 7697.

1. change LED from **13 to 7** - because the built-in USR LED maps to **P7**:

   ```
   int ledPin = 7; // select the pin for the LED
   ```
2. The original sketch logic maps the output value of `analogRead` to delay milliseconds between LED blinks. Since the output ranges from 0 to 4096, the delay might be too long to observe. To solve this problem you can divide the output values by 4, for example:

   ```
   sensorValue = analogRead(sensorPin) / 4; // maps 4096 back to 1024
   ```
3. The input voltage accepts 2.5V, but the board only provides 5V and 3V3 sources. You can map 5V to 2.5V easily with a [voltage-divider circuit](https://learn.sparkfun.com/tutorials/voltage-dividers), shown below:

![](https://3972650740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY4gduUSLWOCI23CXUWej%2Fuploads%2F1N9WdGhmyelj4DUTistA%2Fanalog_input.png?alt=media\&token=c7753449-1861-4f16-9292-c7b367bccd81)
