I am a beginner to Arduino and programming and I am trying to do a piece of code that runs once every thirty minutes for a short period of seconds.
I figured out how to do it every once an hour but I cannot figure out how I am going to stop it for the rest of the remaining minute.
This is the code:
if ((incubationMinutes % 30 == 0 && motorIdentifier == 1) && (incubationTime/86400 >= incubationDays - 3))
{
if(timeConveyorWatch != timeInMillis)
{
conveyorStateRunningTime++;
timeConveyorWatch = timeInMillis;
}
if (conveyorRunningTime >= conveyorStateRunningTime)
{
motorIdentifier = 1;
digitalWrite(conveyor, HIGH);
}
else if (conveyorRunningTime <= conveyorStateRunningTime)
{
motorIdentifier = 0;
digitalWrite(conveyor, LOW);
timeConveyorWatch = 0;
}
}
The conveyorStateRunningTime is increasing by one every milli second.
Now how I am going to activate the motorIdentifier once every 30 minutes and making it 0 again as the conveyorRunningTime has expired.
Thanks