Skip to main content
edited title
Link
Michel Keijzers
  • 13k
  • 7
  • 43
  • 59

Averaging input from multiple input over a fixed amount of time (estiamtedestimated)

Code formatting.
Source Link
Edgar Bonet
  • 45.2k
  • 4
  • 42
  • 81

I am trying to average input values for a number of inputs and have it then store those averages into a string to write to a txt doc on a sd card.

I am using  :

// read 6 sensors and append to the string: for (int analogPin = 0; analogPin < 6; analogPin++) { int sensor = analogRead(analogPin); dataString += String(sensor); if (analogPin < 6) { dataString += ","; } }

// read 6 sensors and append to the string:
for (int analogPin = 0; analogPin < 6; analogPin++) {
  int sensor = analogRead(analogPin);
  dataString += String(sensor);
  if (analogPin < 6) {
    dataString += ",";
  }
}

to read the pins at the moment, but I want to change the analogRead(analogPin) to an average value and then use the averages to create the string.

but when I try to average the data I run into errors, or I get output that is 0 for something that should be higher (3.3V).

I am doing this to stabilize my values a bit better and remove jitter.

Any suggestions?

I am trying to average input values for a number of inputs and have it then store those averages into a string to write to a txt doc on a sd card.

I am using  :

// read 6 sensors and append to the string: for (int analogPin = 0; analogPin < 6; analogPin++) { int sensor = analogRead(analogPin); dataString += String(sensor); if (analogPin < 6) { dataString += ","; } }

to read the pins at the moment, but I want to change the analogRead(analogPin) to an average value and then use the averages to create the string.

but when I try to average the data I run into errors, or I get output that is 0 for something that should be higher (3.3V).

I am doing this to stabilize my values a bit better and remove jitter.

Any suggestions?

I am trying to average input values for a number of inputs and have it then store those averages into a string to write to a txt doc on a sd card.

I am using:

// read 6 sensors and append to the string:
for (int analogPin = 0; analogPin < 6; analogPin++) {
  int sensor = analogRead(analogPin);
  dataString += String(sensor);
  if (analogPin < 6) {
    dataString += ",";
  }
}

to read the pins at the moment, but I want to change the analogRead(analogPin) to an average value and then use the averages to create the string.

but when I try to average the data I run into errors, or I get output that is 0 for something that should be higher (3.3V).

I am doing this to stabilize my values a bit better and remove jitter.

Any suggestions?

reformatted text, deleted repeated statement
Source Link

I am trying to average input values for a number of inputs and have it then store those averages into a string to write to a txt doc on a sd card. 

I am using :   

// read 6 sensors and append to the string: for (int analogPin = 0; analogPin < 6; analogPin++) { int sensor = analogRead(analogPin); dataString += String(sensor); if (analogPin < 6) { dataString += ","; } } 

to read the pins at the moment, but I want to change the analogRead(analogPin) to an average value and then use thisthe averages to create the string., 

but when I try to average the data I run into errors, or I get output that is 0 for something that should be higher (3.3V). Any suggestions? I need to average all the inputs before they are saved to the string. 

I am doing this to stabilize my values a bit better and remove jitter.

Any suggestions?

I am trying to average input values for a number of inputs and have it then store those averages into a string to write to a txt doc on a sd card. I am using :   // read 6 sensors and append to the string: for (int analogPin = 0; analogPin < 6; analogPin++) { int sensor = analogRead(analogPin); dataString += String(sensor); if (analogPin < 6) { dataString += ","; } } to read the pins at the moment but I want to change the analogRead(analogPin) to an average value and then use this to create the string., but when I try to average the data I run into errors, or I get output that is 0 for something that should be higher (3.3V). Any suggestions? I need to average all the inputs before they are saved to the string. I am doing this to stabilize my values a bit better and remove jitter.

I am trying to average input values for a number of inputs and have it then store those averages into a string to write to a txt doc on a sd card. 

I am using : 

// read 6 sensors and append to the string: for (int analogPin = 0; analogPin < 6; analogPin++) { int sensor = analogRead(analogPin); dataString += String(sensor); if (analogPin < 6) { dataString += ","; } } 

to read the pins at the moment, but I want to change the analogRead(analogPin) to an average value and then use the averages to create the string. 

but when I try to average the data I run into errors, or I get output that is 0 for something that should be higher (3.3V). 

I am doing this to stabilize my values a bit better and remove jitter.

Any suggestions?

Source Link
Loading