Playing to the gear ratio - if a reduction gear is attached - helps with figuring out how many steps make 360 degrees. ...and once in a while 'go back' to calibration point (end switch / light gate) to reset 0... Using Espruino for running a stepper fast can be an issue because of other things that can go on. From performance page we know that you can loop over two pin set()s about 4K times/sec 0.25ms/cycle. Two pin sets is pretty little... an optimized interval construct on 2ms and considering the optimized (array-ed) pin sets for the stepper leave about 1.5..1.75 ms left for to do other things, until you will notice at least slow down, but more so stuttering (leaving the stepper running at max speed over some time just placed on a sounding surface will bring that to our ear as hum with interceptions...).
© Espruino, powered by microcosm.
Report a problem