Hello. Thanks for your answers
manjey73: The channels’ values that hold hours and seconds
mikhail: This is the final function which simply check if the current time is inside the specified period or not, then returns 1 or 0 to an input channel that have the signal of the hardware location connected to OpenPLC program on the other side
double TargetMin;
double On_Period(double hour, double minutes, double ONminutes, double ONseconds)
{
TargetMin = minutes+ONminutes;
if(DateTime.Now.Hour == hour && DateTime.Now.Minute >= minutes){
if(DateTime.Now.Minute <= TargetMin)
return 1;
else if(DateTime.Now.Second <= ONseconds)
return 1;
}
return 0;
}
-
This reply was modified 1 year, 5 months ago by Fatma.
-
This reply was modified 1 year, 5 months ago by Fatma.