Data to Excel

I'm relatively new to writing my own code (most of my experience is in R for data analysis purposes). Anyways, I have a research project that I'm working on and I have some questions about how I can manipulate my arduino code to print voltage changes from multiple IR receivers to my excel doc using PLX DAQ v.11. Basically, I'm using a multiplexer to group my receiver data and I know that the setup is wired correctly. My problem is that I can't seem to get the voltages to print out in excel. My code for an individual diode pair works perfectly, but when I add in multiple inputs, things get odd.

Here is my code for the individual pair:

void setup() {
  
  Serial.begin(9600);
  Serial.println("CLEARSHEET");
  Serial.println("LABEL,Time, Voltage"); 

  
}

void loop() {
  
  
        //int aVal = analogRead(A0);
        

        unsigned int ADCValue;
        double Voltage;
        double Vcc;

        Vcc = readVcc()/1000.0;
        ADCValue = analogRead(A0);
        Voltage = (ADCValue / 1024.0) * Vcc;

        int aVal = (int)(Voltage*100);
        Serial.print("DATA, TIME");
        Serial.print(",");
        Serial.println((int)(Voltage*100));

        delay(60);
        
}

long readVcc() {
  long result;
  // Read 1.1V reference against AVcc
  ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
  delay(2); // Wait for Vref to settle
  ADCSRA |= _BV(ADSC); // Convert
  while (bit_is_set(ADCSRA,ADSC));
  result = ADCL;
  result |= ADCH<<8;
  result =1135200L / result; //1149852L / result; // Back-calculate AVcc in mV
  return result;
}

Here is what I have for the multiplexer version

int pin1 = 8;
int pin2 = 9;
int pin3 = 10;
// digital pins to be switched 


void setup() {
  Serial.begin(9600);
  pinMode(pin1, OUTPUT);
  pinMode(pin2, OUTPUT);
  pinMode(pin3, OUTPUT);
  Serial.println("LABEL, Time, Cage 1, Cage 2");
}

void loop() {
  
  set(1,0,0); // set pin 4
  Serial.println(analogRead(0));
  delay(10);
  set(1,0,1); // set pin 5
  Serial.println(analogRead(0));
  delay(10);
  set(0,1,0);// set pin 2
  Serial.println(analogRead(0));
  delay(10);
  Serial.print("DATA, TIME");
    Serial.print(",");
    Serial.print(digitalWrite(pin1, HIGH));
    Serial.print(",");
    Serial.println(digitalWrite(pin2, HIGH));

  delay(60);
}

void set(int a, int b, int c) //selects which pin on the multiplexer to read from
{
  if(a == 1)
  {digitalWrite(pin1, HIGH);}
   else{digitalWrite(pin1, LOW);}
  
  
  if(b == 1)
  {digitalWrite(pin2, HIGH);}
  else{digitalWrite(pin2, LOW);}
  
    
  if(c == 1)
  {digitalWrite(pin3, HIGH);}
  else{digitalWrite(pin3, LOW);}
  

  
}

Any help would be greatly appreciated!

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

From Non-Mux version:
Serial.print("DATA, TIME");
Serial.print(",");
Serial.println((int)(Voltage*100));

From Mux Version:
Serial.print("DATA, TIME");
Serial.print(",");
Serial.print(digitalWrite(pin1, HIGH));
Serial.print(",");
Serial.println(digitalWrite(pin2, HIGH));

I don't see a adc conversion in the mux version nor do I see it trying to be printed.

What is the mux version trying to print? The result of the digitalWrite function call?

P.S. You forgot the code tags when you posted your sketch.

P.P.S. This isn't a PLX-DAQ problem, it should not be part of this thread.

I'm not certain why there is no adc conversion in the mux version. I'm working off of code that one of my previous classmates wrote for the project. I'm now trying to modify it for this new purpose. I do know that the multiplexer sends back three voltage signals, granted unmodified, because I can visualize them in the Arduino serial monitor and observe the corresponding changes I expect. The value doesn't matter to me. When I eventually analyze the data I'll determine the baseline and turn all values significantly different from the baseline into 1's and the rest into 0's. That will give me a rotation count from each running wheel. I suppose I should be asking the original code writer what the print out value should be (he didn't comment his code very much). Regardless, thank you! What thread would have been the appropriate one? I came here because I assumed the code that PLX reads would be my issue.

Please start your own thread and repost the code. In the meantime, you will need to review the code and work to understand what each line does. The two versions of the program are VERY different. I suggest you start with the non-mux program and modify it to make a new mux version. When the new version doesn't work, fall back to a version that does and work forward from there.

@Dwood1003, do not hijack. Thread split.