Hello. I have a unipolar stepper motor 28BYJ48 with the ULN2003 Driver. I know there was a lot of questions about it on the forum, but my question is about the speed. I used some codes and the one is better is here. It's by AllyCat. (Thank you). The speed is 2-3RPM. Changing the PAUSE (symbol gapwid = 8) gives a little difference but it stops on 4. M08 doesn't go more than SETFREQ m16. So, how the speed can be changed or is there any better code to go faster.
Thank you
Thank you
Code:
#picaxe 08m2
symbol A1 = c.0 ; Select as required
symbol A2 = c.2 ; *swapped
symbol cB1 = c.1 ; *swapped
symbol cB2 = c.4
symbol direction = pinc.3
symbol gapwid = 8 ; Adjust for speed
symbol gapwid1 = gapwid - 1
setfreq m16 ; Or as required
forwards:
pause gapwid1 : Low A2 : High A1 ; Enable coil A+
pause gapwid : Low cB2 : High cB1 ; Enable coil B+
pause gapwid : Low A1 : High A2 ; Enable coil A-
pause gapwid : Low cB1 : High cB2 ; Enable coil B-
if direction = 0 then forwards ; Or fall into backwards
backwards:
pause gapwid1 : Low A2 : High A1 ; Enable coil A+
pause gapwid : Low cB1 : High cB2 ; Enable coil B-
pause gapwid : Low A1 : High A2 ; Enable coil A-
pause gapwid : Low cB2 : High cB1 ; Enable coil B+
if direction = 1 then backwards
goto forwards
Last edited by a moderator: