Summing together 10 readings

Hi,

I’m taking in sensor data from the serial port using the function below.

How could I take in 10 readings and sum them together?

Thanks

void showNewData() {
  if (newData == true) {
    char* reading = receivedChars + 1;
    sensorReading = atoi(reading);
    newData = false;
  }
}

Using the + operator, or the += compound operator.

(that was just a snippet of the full answer)

Create a global sum variable, set it to zero before the readings and then what AWOL said.

Have a look here - it looks like this guy has a very similar problem