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

Software Preparation

Wiring Diagram

DFR0923- Analog 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.

DFR0923-Analog result

Was this article helpful?

TOP