If the data is +, then rotate to the right Nilai = map(a, 0, 360, 0, stepsPerRevolution) stepsPerRevolution 200 is not used in this code. In this program, we will try to rotate the stepper motor to be able to move from 1° to 360°, then back to 0°, and so on. If you are still confused about the step per resolution and the numbers, you can read the article How a stepper motor works, its types and microstepping.
As for the left (red) switch, I enabled (On) only on the S4, because in this basic example, I’m going to use a 1/16 step per resolution. Look at the picture above, I activate (On) on SW2, because I only use 0.5A current in this experiment. To be able to control or move the stepper motor using the TB6560 driver, we must connect the Arduino to this Driver IC correctly. You can replace it according to your needs. As for Power, in this article I use an adapter with a voltage of 9V and a current of 1A.