Page 1 of 1

Step by step Motor driver A4988

Posted: Sun Jun 06, 2021 2:36 pm
by Baptiste
Hello, I am a new user and I have an issue with my software .
I want to control my motor with a driver but my program does not work.
Could you help me to solve this problem?
I use Putty to run the code
Below you can find my program and the error message:

from machine import Pin
from machine import Signal
from time import sleep_ms

enable_pin = Pin("Y12",Pin.OUT, value = True)
enable = Signal(enable_pin, invert = True)

_dir = Pin("X7",Pin.OUT, value = False)
step = Pin("X8",Pin.OUT, value = False)

enable.value( True )
while True:
_dir.value(not(_dir.value()))
for i in range(100):
step.value(1)
sleep_ms(1)
step.value(0)
sleep_ms(1)
sleep_ms(500)

Error message:
>>> exec(open('TEST.py').read())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 13, in <module>
AttributeError: 'function' object has no attribute 'value'


Thanks for your answer,
Bye