# Micro-Stepping; 32 steps per cycle from machine import Pin, PWM from time import sleep_ms PA = Pin(16,Pin.OUT) PA = PWM(Pin(16)) PA.freq(100) PA.duty_u16(0) PB = Pin(17,Pin.OUT) PB = PWM(Pin(17)) PB.freq(100) PB.duty_u16(0) PC = Pin(18,Pin.OUT) PC = PWM(Pin(18)) PC.freq(100) PC.duty_u16(0) PD = Pin(19,Pin.OUT) PD = PWM(Pin(19)) PD.freq(100) PD.duty_u16(0) TABLE32 = [0, 12681, 24874, 36112, 45962, 54046, 60052, 63751, 65000, 63751, 60052, 54046, 45962, 36112, 24874, 12681, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] def Step32(X): A = TABLE32[X % 32] PA.duty_u16(A) B = TABLE32[(X+8) % 32] PB.duty_u16(B) C = TABLE32[(X+16) % 32] PC.duty_u16(C) D = TABLE32[(X+24) % 32] PD.duty_u16(D) x = 0 for i in range(0,1600): x += 1 Step32(x) sleep_ms(5) PA.duty_u16(0) PB.duty_u16(0) PC.duty_u16(0) PD.duty_u16(0)