Code:
Int independent_On_Off()
{
if ((ON_VNH5019 == HIGH) && (ElapsedOFF >= OFFTime1)) //OFFTime first
{
ON_VNH5019 = LOW;
// ElapsedOFF=ElapsedOFF-OFFTime1;
//switch off the VNH5019
digitalWrite(INA,LOW); digitalWrite(INB,LOW);//break mode
ElapsedOFF = 0; ElapsedON = 0;
// tft.setRotation(4);
tft.fillRect(110, 145, 10, 10, C_RED);
}
else if ((ON_VNH5019 == LOW) && (ElapsedON >= ON_Time1)) //ONTime Second
{
ON_VNH5019 = HIGH;
ElapsedOFF = 0; ElapsedON = 0;
INA==HIGH,INB==HIGH;
Switch_UtoBipolar();
}
if (ON_VNH5019 == LOW) tft.fillRect(110, 145, 10, 10, C_YELLOW);
}
}
Int Switch_UtoBipolar()
{
if(myButton.held() == true) //Bipolar
{
for(int i=0;i<repeats;i++)
{
if((INA==HIGH&&INB==HIGH)&&(INA==LOW&&INB==LOW)) //start condition.
INA==LOW, INB==HIGH;
digitalWrite(INA,Pin1);digitalWrite(INB,Pin2);
}
else //holdbutton is pressed for the second time
{
INA==HIGH, INB==LOW;
digitalWrite(INA,Pin1);digitalWrite(INB,Pin2);
}// i dont think this is going to work....
}
else //unipolar
{
for(int i=0;i<repeats;i++)
{
if((INA==HIGH&&INB==HIGH)&&(INA==LOW&&INB==LOW))
{
INA==LOW, INB==HIGH;
digitalWrite(INA,Pin1);digitalWrite(INB,Pin2);
}
else
{
INA==HIGH, INB==HIGH;
digitalWrite(INA,Pin1);digitalWrite(INB,Pin2);
}
}
}
I’d expect the code will run this as fast as possible and toggle the digitalWrite
INA,INB during the ON time of the independent On_Off function.
Is there a way to check that there is a delay time between INA and INB.
The reason for this is that I don’t know if the VNH5019 does this automatically see datasheet on page 9 Tdel
Many thanks for reading!
Best regards
Bastiaan