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

    processMessage(msg);
    aJson.deleteItem(msg);
  }
  
  // Until USB has been connected, display a spinning wheel on
  // the 7 segment display.
  if (!usbConnected) {
    for (int c = 0; c < 6; c++) {
      sendDigit(circle[c]);
      delay(50);
    }
  }
}

/*
 Three cases so far:
 {"name": "shift", "value": 1}     value is an integer. either 1 or 0.

}

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.
