I made a new timing library similar to "TimedActions" but even simpler! You can make timed sequences of code with each step lasting a variable amount of milliseconds without ever using delay()!!! I think it is unique, but due to the simpleness of the library I would not be surprised if someone thought of this already. But what I need help with is not the library itself. I cant seem to find a way to advertise my library on here like timed actions is... I seems like it SHOULD be easy. Someone help me please!
I attached the header file (.h) and code file (.cpp) and an example so you guys can check if this has been done before also. Thanks for any help!
You just posted it on the forum, next step might be writing an article for the playground and explain the lib in more detail.
Furthermore I advice you to open a github account where people can download the latest (or earlier ) versions of your lib.
Be aware that most libraries will not become part of the distribution to keep the core "lean and mean"
I had a quick peek at the .cpp/.h code and have the following tips / remarks.
Check your indentation style to improve readability. (I use notepad++ TextFx plugin, has a good reindenter)
#ifndef Sequence_h
#define Sequence_h
/*
Sequence.h - library for creating timed sequences of code.
Created by Austin W. Rowe, October 30, 2013.
Released into the public domain.
*/
#include "Arduino.h"
class Sequence
{
public:
Sequence();
void setFuse(int Fuse);
void start(int Steps);
void pause();
void unpause();
void gotoStep(int StepNum);
int getStep();
int Step;
private:
long TimeLast;
long TimePaused;
unsigned long TimeCurrent;
int _Fuse;
bool paused;
};
#endif
long TimeLast;
long TimePaused;
should both be unsigend long as they hold time derived from millis()
as steps are only positive numbers use an unsigned int (or byte) as datatype
if pause is set to true, and I call start() TimeLast is not initialized.
and be prepared to get lots of comments. See it as improvements to your good work and not as criticism.
This is probably the hardest part for many people who published open source.
robtillaart:
You just posted it on the forum, next step might be writing an article for the playground and explain the lib in more detail.
Furthermore I advice you to open a github account where people can download the latest (or earlier ) versions of your lib.
Be aware that most libraries will not become part of the distribution to keep the core "lean and mean"