#define INANALOG1 34
#define INANALOG2 35
float voltaje;
float corriente;
float potencia;
float resistencia;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("MULTIMETRO");
pinMode(INANALOG1, INPUT);
pinMode(INANALOG2, INPUT);
}
void loop() {
// el valor de 17.0625 se obtiene de divivir
//240x=4095, que son los valores maximos del voltaje y el punto
// maximo del potenciometro despejando el valor de "X" nos queda
//4095/240=17.0625 que es el valor del ADC,este se divide entre
//INANALOG1)/17.0625(INANALOG2)/40.95 voltaje y corriente respectivamente
voltaje= analogRead(INANALOG1)/17.0625;
corriente= analogRead(INANALOG2)/40.95;
potencia= voltaje * corriente;
resistencia = voltaje / corriente;
Serial.print("VOLTAJE: ");
Serial.print(voltaje);
Serial.println(" V");
Serial.print("CORRIENTE: ");
Serial.print(corriente);
Serial.println(" A");
Serial.print("POTENCIA: ");
Serial.print(potencia);
Serial.println(" W");
Serial.print("RESISTENCIA: ");
Serial.print(resistencia);
Serial.println(" Ω");
Serial.println();
delay(500);
}