How to display both value of adc on excel

Hello , i'm facing a porblem during printing value on excel sheet, it print only value of x,
i want to print both value x , and y in excel using plx daq. pleas help me

type or paste code here
```#include "Wire.h"
#include <LiquidCrystal.h>
#define EEPROM_I2C_ADDRESS 0x50
LiquidCrystal lcd(12,11,5,4,3,2);

 int z;

byte i;
byte adcdata[8];
unsigned int x2,x3,y2,y3;
unsigned long x,y,x1,y1,Adata,Bdata;


void setup() {
  // put your setup code here, to run once:
 Serial.begin(9600);
  lcd.begin(20,4);
  Wire.begin();
  analogWrite(6,z);  //Display intensity
pinMode(13,OUTPUT);
Serial.println("CLEARDATA"); //clears up any data left from previous projects

Serial.println("LABEL,TIME ,DATA,ADC1,ADC2,ADC3,..."); //always write LABEL, so excel knows the next things will be the names of the columns (instead of Acolumn you could write Time for instance)

Serial.println("RESETTIMER"); //resets timer to 0

}

int adc (){
   top:
    for(i=0;i<8;i++)
    adcdata[i] = 0;   
     digitalWrite(13,LOW);
 i=0;
while (adcdata[0]!='N')
{   
  if (Serial.available())
  adcdata[0] = Serial.read();
  }
i=1;
  while (i<9)
{   
  if (Serial.available())
 adcdata[i] = Serial.read();  
  if (adcdata[i]=='N')i=1;
  else if (adcdata[i]!=0) i++ ;  
  }

   x3 = adcdata[4];
   x2= adcdata[3];
   x1=  adcdata[2];
   y3 = adcdata[7];
   y2=  adcdata[6];
   y1=  adcdata[5];
     delay(100);
  if (adcdata[1]=='V')
   {
   y= (y1*256*256+y2*256+y3)/100;
   x= (x1*256*256+x2*256+x3)/100; 
   digitalWrite(13,HIGH);
   Serial.println(x);
   Serial.println( y);
  return x,y;
   }
   else
   goto top ;
}
void loop() {
  
 
  Serial.print("DATA,TIME,TIMER,"); //writes the time in the first column A and the time since the measurements started in column B

int g,j;
x,y=adc();
j=y;
Serial.print(x);
Serial.print(",");
Serial.println(j);

Serial.println('...'); //be sure to add println to the last command so it knows to go into the next row on the second run

delay(100); //add a delay
  lcd.clear();
  lcd.setCursor(5,1);
  lcd.print(x);
   lcd.setCursor(5,3);
  lcd.print(j);
delay(1000);
}

Please follow the advice given in the link below when posting code . Use code tags when posting code here to make it easier to read and copy for examination

Is the LCD telling you what it should tell you?
This line is probably redundant.

You seem to have more variables than you need. What is the purpose, or point, of g?

yes lcd is displaying both (x,and j) properly,
and the purpose of 'g' same as' j' , that time i think i'm sending value of x directly this may be reason due to which i'm not get value on excel g=x, Serial.print(g);.............................so sir please ignore g ,

my Question is In excel i got value of 'X' successfully but not get value of 'J' or'y'.
what to do to get value in next column of excel . please go through to attached image

Untitled|690x387

x and y are global variables, there is no need to return them. Further you can not return two values from the adc() function.

  x, y = adc();

does not change x, only y.

I would start by just calling adc() without trying to assign the return values.

please provide solution and also go through to attached image .

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