Timelimit and cooldown on pwm out

Write a separate sketch having a play with millis(), using the blink with out delay example in the IDE , just switching say the built in led in and off .
Try writing something simple with if /else .

If you google say “ Arduino if” you will find examples in its use .

Get that working , then have a go at putting that in your sketch .

This is the best way to learn stuff , have a go and report back ..