I HAVE AN ERROR IN PROGRAMMING AND IT IS URGENT, PLEASE HELP

ASSEMBLY PHOTOGRAPHY: https://drive.google.com/open?id=1LjCZvkVaUXcokuLvEuBIrcyj2Ngb5U2p

The project that I have is to measure the current and the voltage, but I do not know if the programming is good, the voltage sensor is 0V-25V and the current sensor is (+ -30A).

Please check the circuit that allows in the photo because I am using a 9.4V source to raise the voltage wave and thus measure positive values. But I do not know how to do it.

I attach the code:

float sensibilidad=0.66;
int   sensorVoltage = A1; 
float R1 = 30000;
float R2 = 7500; 
float volSalida = 0.0;
float volEntrada = 0.0;
int   value = 0;


void setup(){
  // put your setup code here, to run once:

  Serial.begin(9600);
}
void loop()

{

    // Con esto debería aparecer el voltaje de salida de tu sensor de voltaje
  value = analogRead(sensorVoltage);
  volSalida = (value*5.0)/1024.0;
  volEntrada = volSalida / (R2/(R1+R2));
  Serial.print ("Voltaje Salida = ");
  Serial.println (volSalida,3);
  delay(1000);


  //Calcular la corriente del sensor ACS712
  float IDC = calculaCorriente(500);
  Serial.print ("Corriente = ");
  Serial.println (IDC,5);
  delay(1000);
}

//Aquí voy a crear la funcion "calculaCorriente"
//que mando a llamar dentro del loop
float calculaCorriente(int numMuestras)
{
  float leerSensor = 0;
  float intensidad = 0;

  for(int i = 0; i<numMuestras; i++)
  {

    leerSensor = analogRead(A0) * (5.02/1023.0);
  
    intensidad = intensidad + (leerSensor - 2.5)/sensibilidad;
  }

  intensidad = intensidad/numMuestras;
  return(intensidad);
}

(deleted)

duvanpabon:
I HAVE AN ERROR IN PROGRAMMING AND IT IS URGENT, PLEASE HELP

That won't get you any fast help.

Asking good questions can.

Pieter

I understand, the programming you have there to calculate the voltage is just for continuous. Now if I want to measure the alternative voltage that I must change to the code. regards

duvanpabon:
I understand, the programming you have there to calculate the voltage is just for continuous. Now if I want to measure the alternative voltage that I must change to the code. regards

Another person who wants someone else to do his work for him.

Who do you think you are throwing your problem at us?

It is not our problem you can't do your job.
I don't care what you want! whether it is to measure this "alternative voltage" or something else.

.

I just asked for help, thanks for your cooperation. good day

And you also crossposted this, in Spanish, in Sensors. Another bad move.

Pete

just look for a quick solution with the help of your experience.

duvanpabon:
just look for a quick solution with the help of your experience.

What exactly is the problem you want help with?

You posted a program in your Original Post and you did not tell us what it does when you run it or what you want it to do that is different.

Your Google Drive link does not work and, in any case, it is much better to post your pictures here. See this Simple Image Guide

I don't know what is in your picture but what you need to show us is a clearly drawn schematic showing all your connections.

...R

You start by shouting at everyone, thinking your problem is somehow more important than everyone else's. If you didn't start working on this project soon enough, you only have yourself to blame. The only thing you achieve by posting an all-caps title, begging for fast help, is just pissing people off.

This is an online forum of volunteers, not a team of robots that blindly solve any problem you throw at them. A little respect for the people trying to help you is not misplaced.

Second, you fail to explain the problem you're facing. You just post some code, claim it isn't working, and tell everyone to "figure it out!".
Nobody is going to run that code and do the debugging for you.
Explain what's wrong, tell us what you've done to try and diagnose or resolve the problem, and ask specific questions. Show that you've done some effort yourself.