   // starting a trial
   trialtime = millis();
 
-  if (cs <= ISI) {
+  if (csdur <= ISI) {
     doTrace();
   }
   else { doDelay(); }

  pinMode(whisker, OUTPUT);
  pinMode(tonech, OUTPUT);
  pinMode(greenled, OUTPUT); 

  // Default all output pins to LOW - for some reason they were floating high on the Due before I (Shane) added this
  digitalWrite(camera, LOW);

        csch = value;
        break;
      case 5:
        csdur = value;
        break;
      case 6:
        usdur = value;
        break;
      case 7:
        ISI = value;
