 }
 
 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.

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

    processMessage(msg);
    aJson.deleteItem(msg);
  }
}
/*
 Three cases so far:
 {"name": "shift", "value": 1}     value is an integer. either 1 or 0.
