Help with PLX_DAQ

Hello everybody.

I'm doing a project where arduino connects with excel and displays the reading of 2 sensors through PLX_DAQ. The problem is that the values of the sensor readings are not displayed on the same lines, for example, turn 1 of sensor A and turn 1 of sensor B must be displayed on the same line in excel, I can't solve this, here is an excel print and the code.

int LABEL = 1;

void setup(void) {

Serial.begin(9600);                     //  inicialização da comunicação serial
  Serial.println("CLEARDATA");            // reset da comunicação serial
  Serial.println("LABEL,Hora,Melhor Volta A,Ultima Volta A,Volta A,Melhor Volta B,Ultima Volta B,Volta B");   // nomeia as colunas no excel
}
void loop(void) {

//incrementa o contador de volta
        currentLap++;
        tone(36, 7000, 50);

        Serial.print("DATA,TIME,"); //impressão dos dados no excel, iniciando com a data e hora
        Serial.print(Melhor_Tempo); 
        Serial.print(",");
        Serial.print(Tempo);
        Serial.print(",");
        Serial.println(currentLap - 1);

//incrementa o contador de volta
        volta_atual_2++;
        tone(36, 7000, 50);
       
        Serial.print("DATA,TIME, , , ,"); //impressão dos dados no excel, iniciando com a data e hora
        Serial.print(Melhor_Tempo2); 
        Serial.print(",");
        Serial.print(Tempo2);
        Serial.print(",");
        Serial.println(volta_atual_2 - 1);
}

The Serial.println() statement defines the end of one line or one Excel row. So everything you want to appear on one row has to end with that call.

Your program prints two Excel rows per loop iteration.

yes, how do i print just one line with the readings of the two sensors in a single iteration of the loop? I've tried with Serial.print() but it didn't work.

void loop(void) {

//incrementa o contador de volta
        currentLap++;
        tone(36, 7000, 50);

        Serial.print("DATA,TIME,"); //impressão dos dados no excel, iniciando com a data e hora
        Serial.print(Melhor_Tempo); 
        Serial.print(",");
        Serial.print(Tempo);
        Serial.print(",");
        Serial.print(currentLap - 1);  //****

//incrementa o contador de volta
        volta_atual_2++;
        Serial.print(","); 
        Serial.print(Melhor_Tempo2); 
        Serial.print(",");
        Serial.print(Tempo2);
        Serial.print(",");
        Serial.println(volta_atual_2 - 1);
}

Thanks, but your tip only works if the sensors are activated simultaneously, it's not the case with my project.
My project consists of a timing and lap counting system for sports competitions. Thus, the competitor in lane A may be more than one lap ahead of the competitor in lane b or vice versa. Your suggestion the laps will not be counted properly in Excel.

If you want to print data on one excel row, you have to follow the general approach I posted.

This may require you to have individual timestamps for each measurement, which is not a difficult problem to solve. Sit down and think for a few moments about it.

Note that the PC timestamps are not particularly useful, because of variable transmission delays.

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