//ADC VARIABLE
int adc1;
int adc2;
float volt1;
float volt2;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, HERLIANTO - ADC MONITOR READY");
}
void loop() {
// put your main code here, to run repeatedly:
adc1 = analogRead(39);
adc2 = analogRead(36);
/*
ADC = VIN / VREF * 2^BIT
UNO ----> ADC = VIN / 5 * 2^10
= VIN / 5 * 1023
VIN = ADC * 5 / 1023
EAP32 --> ADC = VIN / 3.3 * 2^12
= VIN / 3.3 * 4095
VIN = ADC * 3.3 / 4095
*/
volt1 = (float) adc1 * 3.3 / 4095;
volt2 = (float) adc2 * 3.3 / 4095;
Serial.print(adc1);Serial.print(";");
Serial.print(adc2);Serial.print(";");
Serial.print(volt1);Serial.print(";");
Serial.print(volt2);Serial.print(";");
Serial.println();
delay(1000); // this speeds up the simulation
}