 double pwm_val = xv_config.pwm_min;  // start slow
 double pwm_last;
 double motor_rpm;
+
+boolean motor_enable = true;
 
 PID myPID(&motor_rpm, &pwm_val, &xv_config.rpm_setpoint,xv_config.Kp,xv_config.Ki,xv_config.Kd, DIRECT);
 

{
  byte id;
  int motor_pwm_pin;
  double rpm_setpoint;  // desired RPM
  double pwm_max;
  double pwm_min;


  myPID.SetOutputLimits(xv_config.pwm_min,xv_config.pwm_max);
  myPID.SetSampleTime(20);
  myPID.SetMode(AUTOMATIC);

  initSerialCommands();
}

void loop() {

  sCmd.readSerial();  // check for incoming serial commands

  // read byte from LIDAR and retransmit to USB
  if (Serial1.available() > 0) {
    inByte = Serial1.read();  // get incoming byte:
    Serial.print(inByte, BYTE);  // retransmit
    decodeData(inByte);
  }

  if (motor_enable) {  
    myPID.Compute();
    if (pwm_val != pwm_last) {
      Timer3.pwm(xv_config.motor_pwm_pin, pwm_val);
      pwm_last = pwm_val;
    }
  }

}

void decodeData(unsigned char inByte) {
