Created
March 12, 2021 15:28
-
-
Save elktros/fd8a1abb51d652ff37a527344ce48a11 to your computer and use it in GitHub Desktop.
Code for measuring analog voltage using ESP32 ADC.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define ADCPIN A0 | |
int adcValue; | |
float voltValue; | |
void setup() | |
{ | |
Serial.begin(115200); | |
} | |
void loop() | |
{ | |
adcValue = analogRead(ADCPIN); | |
voltValue = ((adcValue * 3.3) / 4095); | |
Serial.print("ADC Value = "); | |
Serial.print(adcValue); | |
//delay(1000); | |
Serial.print(" "); | |
Serial.print("Voltage = "); | |
Serial.print(voltValue); | |
Serial.println(" V"); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment