Digital sensor survey every 15 minutes

Good day!

I will explain my task in more detail. There is a ground humidity sensor that should take measurements every 15 minutes, the digital output of the sensor is connected to a relay that should turn on the pump when the signal changes. When the signal returns to its original value, the pump should turn off and start counting for 15 minutes. After 15 minutes, the sensor makes a measurement, if the ground is wet, which means the signal has not changed, then again the sensor waits 15 minutes and makes a measurement. As soon as the ground becomes dry during the next measurement and the signal from the sensor changes to the opposite, the pump turns on and pours, the ground becomes wet, the signal changes to the original one and turns off the pump. I present the code in c++, but I’m interested in understanding and programming my device with XOD.