Example Code for Arduino-Analog Port
Last revision 2025/12/27
This article guides readers through setting up and coding Arduino analog ports using FireBeetle 2 ESP32-E, including hardware preparation and sample code.
Hardware Preparation
- FireBeetle 2 ESP32-E IoT Microcontroller (SKU: DFR0654) ×1
- Terminal Block Board for FireBeetle 2 ESP32-E(SKU: DFR0923) ×1
- Analog Rotation Potentiometer Sensor(SKU: DFR0054) ×1
- USB Cable ×1
- PH2.0-3P Wire ×1
Software Preparation
- Download Arduino IDE: Click to download Arduino IDE.
- Install SDK: click to enter FireBeetle ESP32-E IoT Microcontroller Wiki for SDK installation tutorial.
Wiring Diagram

Description:
FireBeete 2 Terminal Shield: 3.3V to Analog Rotation Potentiometer Sensor: P3
FireBeete 2 Terminal Shield: GND to Analog Rotation Potentiometer Sensor: P2
FireBeete 2 Terminal Shield: A0 to Analog Rotation Potentiometer Sensor: P1
Sample Code
Get the analog sensor readings via A0.
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
delay(20);
}
Result
Serial print the values read from A0.

Was this article helpful?
