But I would want to understand why the code below doesn't work?It is expected to do same think but not.
var step = 0;
var steps = [0b0001,0b0011,0b0010,0b0110,0b0100,0b1100,0b1000,0b1001];
var stepperPins = [D1,D2,D3,D4]; // Change these to pins for your motor driver
function doStep() {
step++;
digitalWrite(stepperPins, steps[step % steps.length]);
}
var stepInterval = setInterval(doStep, 1);
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
But I would want to understand why the code below doesn't work?It is expected to do same think but not.