26.09.2017, 15:50
first you must define iif gate is open or close
fdgate1 < dis one make another global variable fdgatestatus. much better if enum I guess?
after that if fdgatestatus= 0 > meaning it's close
if(!fdgatestatus)
{
// open the gate
fdgatestatus = 1; //set it to open
}
else
{
//close the gate
fdgatestatus = 0; // set it to close
}
fdgate1 < dis one make another global variable fdgatestatus. much better if enum I guess?
after that if fdgatestatus= 0 > meaning it's close
if(!fdgatestatus)
{
// open the gate
fdgatestatus = 1; //set it to open
}
else
{
//close the gate
fdgatestatus = 0; // set it to close
}