Step by step Motor driver A4988

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
Baptiste
Posts: 1
Joined: Sun Jun 06, 2021 2:21 pm

Step by step Motor driver A4988

Post by Baptiste » Sun Jun 06, 2021 2:36 pm

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

Post Reply