int main( int argc, char **argv ) {
  // printf("Sample test for Checking the Calibration on the board: %s, %s", AIOUSB_GetVersion(), AIOUSB_GetVersionDate());
  unsigned long result = AIOUSB_Init();

  struct options opts = { 0, 0 };
  opts = get_options(argc, argv);

  if( result == AIOUSB_SUCCESS ) {
          
    unsigned long deviceMask = GetDevices();
    if( deviceMask != 0 ) {
      // at least one ACCES device detected, but we want one of a specific type
      // AIOUSB_ListDevices();
      TestCaseSetup tcs;
      try { 
        tcs.findDevice();
        tcs.setCurrentDeviceIndex(0);
        tcs.doPreSetup();
        tcs.doBulkConfigBlock();
        tcs.doSetAutoCalibration();
        tcs.doVerifyGroundCalibration();
        tcs.doVerifyReferenceCalibration();
        tcs.doPreReadImmediateVoltages();

        if( opts.use_maxcount ) 
          tcs.setMaxCount( opts.maxcount );

        // tcs.doCSVReadVoltages();
        tcs.doCSVWithGetChannelV();
        // while(1) { 
        //   tcs.doCSVReadVoltages();
        //   // usleep(0.1);
        //   counter ++;
        //   if( opts.use_maxcount ) 
        //     if( counter > opts.maxcount ) 
        //       break;
        // }
      } catch ( Error &e  ) {
        std::cout << "Errors" << e.what() << std::endl;
      }
    }
  }
}