     digitalWrite(motorPin, motorState);
     motorPulse = motorCount;
   }
-  
+}
+
+void getData() {
   if (serialStream.available()) {
     serialStream.skip();
   }

  shiftOut(dataPin, clockPin, LSBFIRST, i);  
  //take the latch pin high so the LEDs will light up:
  digitalWrite(latchPin, HIGH);
}

}

void loop() {
  controlMotor();
  getData();
  isUsbConnected();
}

void controlMotor() {
  // Is the motor on? If so, has it been on for more time than motorOn?
  // Is the motorCommand still ON or has it been turned off by other logic?
  // If all true, then turn off the motor and record the time.
