Example Code for Arduino-Analog Read
Last revision 2026/01/24
This guide walks you through using Arduino to perform analog reads, detailing hardware and software setups with Intel Edison, and includes sample code to read sensor data from pin A0, displaying results in the serial monitor.
Hardware Preparation
- Romeo for Intel® Edison Controller(SKU: DFR0350) ×1
- Intel® Edison Module(SKU: DFR0335) ×1
- micro USB ×1
Software Preparation
- Download Arduino IDE: Click to download Arduino IDE.
- Download DFRobot_Edison library V1.1
Other Preparation Work
- Download and install the DFRobot_Edison library V1.1 (required for Atmel mega 8 analog pin driver).
- Open Arduino IDE, select Tools --> Board --> Intel Edison and Tools --> Serial Port --> COM xx.
As Romeo for Edison is using ATmega 8 as Analog pins driver. Please download the DFRobot4Edison library first. The library is keeping update, so some sample code and picture will be different to the old one.
Sample Code
Import two libs, init Serial 9600, read A0 analog value and print periodically.
#include <DFRobot.h>
#include <IIC1.h>
unsigned int value = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
value = analogRead(A0);
Serial.println((int)value);
delay(2000);
}
Result
The analog value from pin A0 is printed to the serial monitor every 2 seconds.

Was this article helpful?
