 float load2_total = 0.0;
 
 float v_in = 5.04;// Measure and correct the V in.
+float v_in_total = 0.0;
+float v_in_array[number_of_readings];
+
 float load1_v_out = 0.0;
 float load2_v_out = 0.0;
 float res_1 = 50350.0; // Measure the value of R1 in voltage divider circuit.

// 9. Software Serial to FFT
//10. Node Metadata
#include <SoftwareSerial.h>


//Analog sensors
//+5V Position Sensor

//+3.3V Fluid Leve
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                            Analog smoothing
const int number_of_readings = 30; //Increases the size of global variables big time. Can be be managed in case we run into memory issues
int analog_index = 0;

float smoothing(const int* numb_readings, float* total_sum,
                float* array_item, int* analog_pin){

  *total_sum -= *array_item;
  *array_item = analogRead(*analog_pin);
  *total_sum += *array_item;
  float result = *total_sum / *numb_readings;
  return result;
}

float smoothing_Vin(const int* numb_readings, float* total_sum,
                float* array_item){

  *total_sum -= *array_item;
  *array_item = emon1.readVcc()*0.001;
  *total_sum += *array_item;
  float result = *total_sum / *numb_readings;
  return result;
