Hm, I don't see why that doesn't work - it should, and is a much more efficient way to do it in Espruino.
Does this work? (this is more efficient than how you're doing it, but not as good as how you had it, which I think should work.
var step = 0;
pinMode(D1,'output');
pinMode(D2,'output');
pinMode(D3,'output');
pinMode(D4,'output');
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++;
console.log("doing step:"..step);
//digitalWrite(stepperPins, steps[step % steps.length]);
var stepval=steps[step % steps.length];
console.log(stepval);
digitalWrite(stepperPins[0],stepval&1);
digitalWrite(stepperPins[1],stepval&2);
digitalWrite(stepperPins[2],stepval&4);
digitalWrite(stepperPins[3],stepval&8);
}
var stepInterval = setInterval(doStep, 1);
Also, what board are you using that has pins D1-D4 broken out? Most of them don't have port D available. Have you verified that the board is generally working, particularly that time is running at the right speed on it?
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.
Hm, I don't see why that doesn't work - it should, and is a much more efficient way to do it in Espruino.
Does this work? (this is more efficient than how you're doing it, but not as good as how you had it, which I think should work.
Also, what board are you using that has pins D1-D4 broken out? Most of them don't have port D available. Have you verified that the board is generally working, particularly that time is running at the right speed on it?