Motor speed pattern code?


I am looking for some help controlling a motor(and yes I’ve browsed the forum) in specific patterns. What I want is to set certain speeds for certain lengths of time and have a lot of different sequences. For example, I want the motor to spin for 6 seconds at 40 rpm, then for 3 seconds at 20rpm, then 5 seconds at 100rpm(by “a lot of different sequences”, I mean keep this cycle up. Keep changing the rpm for a given amount of time for as many times as I want. Then have all the sequences loop back to the first.) Can anyone give a code that I can copy and paste and just set my own parameters (rpm and time)? Or will this be much more confusing?

Isn't this what Stuxnet was designed to do?

Isn’t this what Stuxnet was designed to do?

I don’t know, but that doesn’t exactly help me…