• Modules and OOP are not necessarily tied together... if you want to have just one stepper in your system, you do not need to go for a class, module works just fine. If you though want to have multiples, the code has to undergo some changes in order to take advantage of the OOP ideas... AND the abilities of ESPRUINO Javascript implementation.

    You can start exactly the way @Gordon suggests - and you can even nicely test it in the IDE. Put your code plus the 3-liner from @Gordon into the file stepper.js and save it in the modules folder of your project sandbox folder.

    In your runtime code you can then get a stepper the way @Gordon shoes in the one-liner.

    stepper.doStep(512); will then give you one turn on the drive shaft.

    Do you intend to have more than one stepper in your setup?

About

Avatar for allObjects @allObjects started