Outputting Data to Data Streamer in Excel

Hello I wrote a code to output a given analog reading as a mV reading with the output in the Serial Monitor. However, after a certain amount of readings (usually 7 or 8) the serial monitor stops showing data. As an alternative I have read that you can use Data Streamer in excel but it says you have to use an input to send to the arduino within excel to get the output also in excel. I am just wanting to get the data that would normally read in the Serial Monitor from the COM port to output in excel

/*
  ReadAnalogVoltage
  https://www.arduino.cc/en/Tutorial/BuiltInExamples/ReadAnalogVoltage
*/

// the setup routine runs once when you press reset:
const int numReadings = 10;

int readings[numReadings];      // the readings from the analog input
int Array[numReadings];
int total = 0;                  // the running total
int average;                // the average

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

  pinMode(4, OUTPUT); //make sure you have set your pins as inputs or outputs
  pinMode(7, OUTPUT);
  pinMode(A0, INPUT);

  analogReference(INTERNAL); //Sets voltage from (0- 1.1V)
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);

}
void loop() {

 int total = 0;
 
  for (int i=0; i < numReadings; i++){
    Array[i] = analogRead(A0);
    delay(1000);
  }
  for (int i=0; i < numReadings; i++){
  total = total + Array[i];
}

  // calculate the average:
  average = total / numReadings;
  
  if (average < 72 ){ //if the analog value of A0 is greater than 37 = ~0.180V then
    
     // Convert the average analog reading (which goes from 0 - 1023) to a voltage (0 - 1.1V):
    float voltage = average * (2.075 * 1000 * 1.1 / 1023.0);
   // Print out the value you read; 
  Serial.print("V1(mV): "); //Displays voltage in mV
  Serial.println(voltage);
  
    delay(10000);
    digitalWrite(4, HIGH);
    delay(8000);
    digitalWrite(4, LOW);
    delay(2500);
    digitalWrite(7, HIGH);
    delay(8000);
    digitalWrite(7, LOW);
    
  }
  else { //if the analog value of A0 is less than 37, make pins 2 and 7 low
    digitalWrite(4, LOW);
    digitalWrite(7, LOW);
  }
  // delay 10000 milliseconds before next reading

  delay(10000);
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.