/*

  PLX-DAQ v2.11 64_bitfor Windows 10. Big thanks to Net'Devil, this is his baby and it is beautiful!

  I have modified the ReadAnalogVoltage sketch to include both A0 and A1 for a dual trace read coming
  from a 555 TTL timer chip (acting as a pulse generator,) 

  The Baud rate @ 19200 is what works for me in Excel 2016 on Windows 10, it's best to experiment which speed works best
  since it is dependent on the right delay value for data transfer.

  The code below as it appears in excel on my CPU uses two columns, the choice is yours depending on what UR doing.

  The 555 TTL timer schematic pulse generator and video demonstration can be found here at my website;

  http://thequantumhub.blog/

  This example code is in the public domain.

  http://www.arduino.cc/en/Tutorial/ReadAnalogVoltage
  • /

unsigned long int milli_time; //variable to hold the time

void setup() {

  Serial.begin(19200);               //Fastest baudrate
  Serial.println("CLEARDATA");        //This string is defined as a
  // commmand for the Excel VBA
  // to clear all the rows and columns
  Serial.println("LABEL,Computer Time,Time (Milli Sec.),Volt,Time2 (Milli Sec.)");
  //LABEL command creates label for
  // columns in the first row with bold font

} void loop() {

  milli_time = millis();
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float voltage = sensorValue * (5.0 / 1023.0);
  Serial.print("DATA,TIME,");
  Serial.print(milli_time);
  Serial.print(",");
  Serial.println(voltage);

  delay(50);

  milli_time = millis();
  // read the input on analog pin 0:
  int sensorValue1 = analogRead(A1);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float voltage1 = sensorValue1 * (5.0 / 1023.0);
  Serial.print("DATA,TIME,");
  Serial.print(milli_time);
  Serial.print(",");
  Serial.println(voltage1);

  delay(50);                    //Take samples every one second

}

Share