You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • I'm not sure about your initial code, but generally it's not very good practice to do a big loop in Espruino - it's much better to use setInterval (as then it can do other things in the background).

    For a description of what the patterns are doing, see the wikipedia page and the animation on it for simple 'wave drive'. When you use half-step, it's almost like you're 'faking' another 4 electromagnets by turning 2 on at once, so you're able to pull the rotor around at 45 degree intervals rather than 90. It means you have a bit more control over the rotor, but also you can move it round with a bit more power.

    If you want to reverse the direction of the motor, simply decrement the 'steps' variable instead of incrementing it. You just want to go through the same step pattern from right to left rather than left to right.

About

Avatar for Gordon @Gordon started