analogWrite() function to create pulses on specified time intervals (or else)

Good afternoon!

I would like to ask if it is possible to use analogWrite() to create pulses in specified time intervals. What I am trying to do is to open and close an electrovalve for specified time intervals. For example I want to command it to turn on for 15 seconds, then to close for 25 seconds, and then repeat this cycle during the whole day, till I manually switch it off. So I want to send a signal at 15 seconds, then at 40(=15+25) then at 55 (=40+15) etc.

If there is another way you suggest I can do the same operation please let me know.

Thank you

The analogWrite() function is used to toggle a pin on and off at much higher frequencies than once every 40 seconds.

You'll need to use digitalwrite() to turn the pin on or off, and your own method of keeping track of when the next change is to occur. The blink without delay example should provide all the clues you need.