     digitalWrite(HbridgeEnablePin, LOW);
     delay(minTime_ms);
     sensorValue = analogRead(analogInPin);
-    Serial.print("sensorValue = " );                       
-    Serial.println(sensorValue);   
-    alphaSigned = 2*((sensorValue-sensorValueMin)/(sensorValueMax - sensorValueMin)-0.5);  
-    Serial.print("alphaSigned = " );                       
-    Serial.println(alphaSigned);   
+//    Serial.print("sensorValue = " );                       
+//    Serial.println(sensorValue);   
+//    //alphaSigned = 2*((sensorValue-sensorValueMin)/(sensorValueMax - sensorValueMin)-0.5);  
+//    Serial.print("alphaSigned = " );                       
+//    Serial.println(alphaSigned);   
     alpha = max(fabs(alphaSigned), deadBand);
     alpha = min(alpha, 1);
       if (alphaSigned>fabs(deadBand))

  double sensorValueMax = 767;//1023
  double deadBand = 0.05; // Should not be zero
  sensorValue = analogRead(analogInPin);
  double alphaSigned = 2*((sensorValue-sensorValueMin)/(sensorValueMax - sensorValueMin)-0.5);  
  double alpha = max(fabs(alphaSigned), deadBand);
  alpha = min(alpha, 1);
  if (alphaSigned>fabs(deadBand))

      digitalWrite(HbridgeLogicPin2, LOW);
    }
  }
//    Serial.print("alpha = " );                       
//    Serial.println(alpha);   
    elapsedTime_ms = millis() - initialTime;
//    Serial.print("elapsedTime_ms = " );                       
//    Serial.println(elapsedTime_ms);    
  }
  digitalWrite(HbridgeEnablePin, LOW);
  delay(fabs(minTime_ms/alpha*(1-alpha)- elapsedTime_ms));

//  // print the results to the serial monitor:
//  Serial.print("alphaManual = " );                       
//  Serial.print(alphaSigned);      
//  Serial.print("\t alphaUsed = ");      
//  Serial.println(alphaSigned);   
}


