Go Down

Topic: Introducing MultiTimer2 Library (Read 697 times) previous topic - next topic


In my next Arduino project I am running a couple of stepper motors. As a first step in making a simple way to run them all at the same time, I build the MultiTimer2 library.
This library makes use of the MsTimer2 library and adds the ability to define several different functions. For every one of them you can define the number of times it should be called and what interval should be used.
Like so:

MultiTimer2::AddTask(Motor1RotateLeft, 200, 20);
MultiTimer2::AddTask(Motor2RotateLeft, 350, 20);
MultiTimer2::AddTask(Motor3RotateRight, 150, 20);

This will rotate 3 stepper motor with different timings 20 steps in different directions. Without using delay(), so using my InfraRed remote control keeps working more-or-less.

Library, including sample code is available for download overhere: http://sites.google.com/site/projectarduino/blog/themultitimer2library

Note that you will also need the MsTimer2 library, available from the playground.

Please let me know what you think of it.


Go Up