 
 const byte EEPROM_ID = 0x99;  // used to validate EEPROM initialized
 
-double pwm_val = xv_config.pwm_min;  // start slow
+double pwm_val;
 double pwm_last;
 double motor_rpm;
 
+boolean debug_motor_rpm = false;
 boolean motor_enable = true;
-
-PID myPID(&motor_rpm, &pwm_val, &xv_config.rpm_setpoint,xv_config.Kp,xv_config.Ki,xv_config.Kd, DIRECT);
+boolean retransmit = true;
+
+PID rpmPID(&motor_rpm, &pwm_val, &xv_config.rpm_setpoint, xv_config.Kp, xv_config.Ki, xv_config.Kd, DIRECT);
 
 int inByte = 0;  // incoming serial byte
 unsigned char data_status = 0;

  motor_enable = true;
  Timer3.pwm(xv_config.motor_pwm_pin, xv_config.pwm_min);
  Serial.println("Motor on");
}

void setRPM() {

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

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