i have to let my stepper motor turn clockwise or anticlockwise with a push of a button with the esp32. i just need to know how to let it turn clockwise, i manage to do it anticlockwise but i can't find it to let it go clockwise. this is my code to let it turn clockwise:
from machine import Pin
from time import sleep, ticks_ms
stepper_pins = [19,21,22,23]
stepper_pin_objects = []
for pin in stepper_pins:
stepper_pin_obj = Pin(pin, Pin.OUT)
stepper_pin_objects.append(stepper_pin_obj)
while True:
for step in range(512):
for x in range(4):
#new magnet on
stepper_pin_objects[x].value(0)
# previoues magnet off
y = x + 1
if y == 4:
y = 0
stepper_pin_objects[y].value(1)
sleep(0.002)
sleep(1)
but it still goes the opposite way
oke i found it :)