Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bessel95/618c8247ac6fa80aa01a1eb325e183c9 to your computer and use it in GitHub Desktop.
Save Bessel95/618c8247ac6fa80aa01a1eb325e183c9 to your computer and use it in GitHub Desktop.
//creado en Arduino nano
//realizado por Blessel95
double res1=1000.0000;
double res2=10000.0000;
double res3=100000.0000;
double res4=5000.0000;
double res5=50000.0000;
double res6=15000.0000;
int numero;
void setup()
{
Serial.begin(9600);
}
void loop()
{
double promedioTotal=(1/res1)+(1/res2)+(1/res3)+(1/res4)+(1/res5)+(1/res6);
double ResistenciaTotal=1/promedioTotal;
double m=analogRead(1);
double voltage = m*(5/1023.0000);
double resistor=660*(5-voltage)/voltage;
double PromedioResultado=1/(resistor);
double ValorResFraccion=promedioTotal-PromedioResultado;
int ValorFinal=(1/ValorResFraccion);
// Serial.println(" RESISTENCIA");
//Serial.println(ValorFinal);
if(ValorFinal<13000)
{
// 1 es para 15
Serial.println(" PANELES SIN NOVEDAD");
}
if(ValorFinal>13000 && ValorFinal<20000)
{
// 1 es para 15
Serial.println("El panel Dañado es el Panel #5");
}
if(ValorFinal>20000 && ValorFinal<80000)
{
// 1 es para 30
Serial.println("El panel Dañado es el Panel #6");
}
if(ValorFinal>80000 && ValorFinal<200000)
{
// 1 es para 30
Serial.println("El panel Dañado es el Panel #5");
}
/* Serial.print("promedio total ");
Serial.print(promedioTotal,6);
Serial.println(" ");
Serial.print(" RESISTENCIA GENERAL ");
Serial.print(ResistenciaTotal,6);
Serial.println(" ");
Serial.print(" RESISTENCIA DEL SENSOR SINTETICO ");
Serial.print(resistor,6);
Serial.println(" ");
Serial.print(" PROMEDIO DE LA RESISTENCIA DEL SENSOR 1/ Rr ");
Serial.print(PromedioResultado,6);
Serial.println(" ");
Serial.print(" VALOR DE LA RESTA RT - RC ");
Serial.print(ValorResFraccion,6);
Serial.println(" ");
Serial.print(" RESISTENCIA FALTANTE RELATIVA ");
Serial.print(ValorFinal,6);
Serial.println(" ");
Serial.println(" ");
*/
delay(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment