I have a vacuum pump powered through an Arduino mega 2560. I want to pass invariable voltage to the pump between 0 to 5v such that the voltage gets changed in the following pattern :- 3v—-2.5v—-5v—-0v—-4v—-3v—-3.5v—-1v—-1v—0v
So my question is do we have any inbuilt library in arduino through which we can somewhat achieve a voltage of such variable pattern ? Also I don’t want to change it manually by using adjustable voltage regulator. My requirement is when i run the code, the voltage changes occur automatically after every 5 seconds.