 {
   if (serialFrequency != 0)
   { // Fallbacks to zero as we received no message in the expected time (twice the time)
-    if ((millis()-lastSerialInputTime) > 2*1/serialFrequency*1000)
+    if ((millis()-lastSerialInputTime) > 2*1/serialFrequency*300)
     {
       alphaSigned = 0;
     }

    // If not in Serial control overwrite the value 
  if (false == isSerialControl)
  {
    // Compute the value corresponding to the deadband
    double sensorDeadBandMax = sensorValueMin + (deadBand/2.0+0.5)*(sensorValueMax - sensorValueMin);
    double sensorDeadBandMin = sensorValueMin + (-deadBand/2.0+0.5)*(sensorValueMax - sensorValueMin);
    if (sensorValue < sensorDeadBandMin) //strictly to avoid alphaSigned equals zero
    {
      alphaSigned = (sensorValue-sensorValueMin)/(sensorDeadBandMax - sensorValueMin)-1;
    } 
    else
    {
      if (sensorValue > sensorDeadBandMax)
      {
        alphaSigned = (sensorValue-sensorDeadBandMax)/(sensorValueMax - sensorDeadBandMax);
      }
      else
      {
        alphaSigned = 0;
      }
    }
  }
  alphaSigned = min(1, max(-1, alphaSigned));
}

      { 
        // note that alpha can't be zero
        double alpha = fabs(alphaSigned);
        if ((micros() - initialTime) < minTime_us*random(100,200)/alpha*(1-alpha)+minTime_us*random(100,200))
        {
              digitalWrite(HbridgeEnablePin, HIGH);
        }
        else
        {
          digitalWrite(HbridgeEnablePin, LOW); // or low?
          initialTime = micros();
          isCycleStarting = true;
        } 
      }
