A microcontroller is used to control a NEMA stepper motor, based on a analogue user input from a potentiometer, as shown in the diagram below. As the user turns the potentiometer the stepper motor output must also follow the movement. When the user stops turning the potentiometer the stepper motor must stop. The interface to the stepper motor controller is via two digital outputs (direction and step). Every time the step output pin is pulsed the stepper motor will increment/decrement 1 step. There are 600 steps in one complete rotation of the stepper motor. For simulation purposes two LEDs (direction and step) will be used to test the system in tinkerCAD.
The microcontroller should "track" the desired position of the motor along with the actual position of the motor using two variables. Both these variables should be printed to the serial monitor and graphed to ensure the system is working correctly.
A yordon diagram should be completed for the system. Two solutions should be developed for this problem, the main one non-state based and one using state-based programming.