I am trying to figure out how to control the speed of a 12-volt fan with 2 digital pushbuttons. one will speed up the fan and the other slows it down. I am thinking of 5 steps, the fan starts off, pushing one button and fan turns on, each push of the first button makes the fan speed up. after 5 pushes the button no longer does anything. then pushing the other button the fan slows down until 5 pushes and fan is off.
Needing links to the code to better understand how to do this. I am still learning code.