I am currently trying to write the code which while all my temp and humid sensors are running in forever, the water pump will automatically turn on for 12 hrs, turn off for 12 hr and turn on 12 hrs again (form a loop of turn on and off). However, I can only allow my water pump to turn on for a certain time and turn off forever when the relay goes from turn on to turn off
Here is my code:
if(TimeStart<TimeEndWP)
{
//XTime_GetTime(&TimeStart);
XGpioPs_WritePin(&output, 13 ,0);
xil_printf("Water Pump On\n\r");
//sleep(100);
} else
{
XGpioPs_WritePin(&output, 13 ,1);
xil_printf("Water Pump Off\n\r");
}
I don't how to change it.
Thanks
Your post was MOVED to it's current location as it is more suitable.
Could you also take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.
Please show your Arduino code. Arduino code is C/C++ code. All C/C++ code must be in a function and all Arduino code must be in setup() and loop() functions (although there are exceptions that don't apply here) . This code is not in ANY function.
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.