##// END OF EJS Templates
Valores Analógicos raw...
JesusTapia-dev -
r6:63b0bf972d79 pruebas
parent child
Show More
@@ -3,7 +3,7
3 int analogValue=0;
3 int analogValue=0;
4 float Vref=3100;// Voltaje de referencia para el ADC
4 float Vref=3100;// Voltaje de referencia para el ADC
5 float Vout=0;
5 float Vout=0;
6 float Plinea=57.6,PdBm=0;;// Valor entre 1 y 500 kW, las unidades son kW
6 float Plinea=57.6,Vpk=0;;// Valor entre 1 y 500 kW, las unidades son kW
7 int VminPot=1;//con esto quiere decir que potencia es la máxima
7 int VminPot=1;//con esto quiere decir que potencia es la máxima
8 bool serialData=0;//Un valor de 1 indica que se debe ingresar por monitor
8 bool serialData=0;//Un valor de 1 indica que se debe ingresar por monitor
9 float VoutRef=1;
9 float VoutRef=1;
@@ -19,10 +19,11 void setup() {
19 String potLinChar = Serial.readStringUntil('\n');
19 String potLinChar = Serial.readStringUntil('\n');
20 Plinea=atof(potLinChar.c_str());
20 Plinea=atof(potLinChar.c_str());
21 }
21 }
22 PdBm=10 *(log10(Plinea)-2);
22 Vpk=sqrt(10*Plinea)/5;
23 VoutRef=ecuacionLineal(PdBm);
23 VoutRef=ecuacionLineal(Vpk);
24 Serial.print("Voltaje de salida de referencia: ");
24 Serial.print("Voltaje de salida de referencia: ");
25 Serial.println(VoutRef);
25 Serial.print(VoutRef);
26 Serial.print("Voltaje pkpk:"); Serial.print(" "); Serial.println(Vpk);
26
27
27 }
28 }
28
29
@@ -35,7 +36,7 void loop() {
35 }
36 }
36 int averageValue = total / numSamples;
37 int averageValue = total / numSamples;
37 Vout = 0.8291*averageValue+90.27;//Ajuste realizado para el ADC
38 Vout = 0.8291*averageValue+90.27;//Ajuste realizado para el ADC
38 Serial.print(Vout);
39 Serial.println(Vout);
39 }
40 }
40 float ecuacionLineal(float PdBm){
41 float ecuacionLineal(float PdBm){
41 float m=-0.02451,b=1.048;
42 float m=-0.02451,b=1.048;
General Comments 0
You need to be logged in to leave comments. Login now