0

I'm trying to send data from four sensors that are connected to my Arduino MEGA to an excel file using PLX-DAQ. So I want to keep taking readings at an interval of 1 second until I wish to stop. So I have two questions. First, this code is not working, I just get three readings but all in one row. And I try resetting the Arduino the first time using the physical button on it, and again I get the next set of three readings AFTER I press the reset button the second time. So there is no real-time updation. For example, I upload the code and I click on connect in PLX_DAQ. I see nothing in the Excel file. I press the reset button, and I get three readings all in one row. I wait for some time, I press reset again and I get another three readings and that's it.

Second, how do I control when to start taking readings or stop taking readings, either using Arduino code or by PLX-DAQ.

int sensC=A12;
int sensA=A13;
int sensB=A14;
int sensD=A15;

void setup() {
  Serial.begin(9600);
  Serial.println("CLEARDATA");
  Serial.println("LABEL,A0-Voltage,B0-Voltage,C0-Voltage,D0-Voltage");
}

void loop() {
  Serial.print(analogRead(sensA));
  Serial.print(",");
  Serial.print(analogRead(sensB));
  Serial.print(",");
  Serial.print(analogRead(sensC));
  Serial.print(",");
  Serial.println(analogRead(sensD));
  delay(1000);
}        

**********EDIT 1**************

@user85471, ok so I added another line right under void loop(), which is: Serial.print("DATA,");

and I ran it again. Now i see my data being stored, but I have four sensors, but only three are of the right output. enter image description here A0-Voltage should be somewhere around 330-340, but I'm getting some sort of a time output.

  • Could you add a copy/paste of what you're seeing in the Serial monitor or your spreadsheet? – user85471 Jul 22 at 6:28
  • @user85471, please check EDIT 1, and help. Thanks :) – Danush Jul 22 at 7:09
  • The first column must always be a timestamp value by the looks of things. – Majenko Jul 22 at 9:55
  • Go back to using the serial monitor in the Arduino IDE. Edit your question to show that output. My guess is there is some problem with the way you are capturing the data into Excel. – Duncan C Jul 22 at 12:15
  • (You should edit your question to explain what PLX-DAQ is, and include a link. I had never heard of it and had to Google it.) – Duncan C Jul 22 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.