This is not just an other multitasking/time-sharing implementation, but also a new way of programing Arduino. In this case you do not implement the "loop()" function, instead you can focus on the tasks need to be done by the software. Please visit the project page at: http://code.google.com/p/arduino-softtimer/

Furthermore SoftTimer comes with a lot of useful tools like software PWM, blinking helper, debouncer, melody player, etc. These function always made trouble by blocking the program. But not any more with SoftTimer.

I'm really excited what you think about my idea. Please feel free to download the library, and share your opinion with me! Thanks!

I am new to arduino. I am trying to make an electronic football scoreboard. It is meant to be operated using an LCD screen and five buttons as digital inputs. I have managed to code the LCD side of things but I am having some difficulty coding the timer. Your library seems be the perfect answer to the problems I am having with the timer part of the code.

Attached is flow diagram showing what the LCD screen shows and what the seven segments are suppose to do.

I am basically trying to use four variables:start_timematch_lengthend_timeinjury_time

An additional variable called match_stage is used to determine if the match is in first half or first half injury or second half or second half injury or penalties.I want to drive the timer variables using the following logic:

I am new to arduino. I am trying to make an electronic football scoreboard. It is meant to be operated using an LCD screen and five buttons as digital inputs. I have managed to code the LCD side of things but I am having some difficulty coding the timer. Your library seems be the perfect answer to the problems I am having with the timer part of the code.

Attached is flow diagram showing what the LCD screen shows and what the seven segments are suppose to do.

I am basically trying to use four variables:start_timematch_lengthend_timeinjury_time

An additional variable called match_stage is used to determine if the match is in first half or first half injury or second half or second half injury or penalties.I want to drive the timer variables using the following logic:

Could you please give me some direction as to how can I use your library to achieve this.

He gives a couple of good examples with his code and it is fairly easy to understand how to put it together.

Essentially this is designed to take you away from having to sprinkle delay(); statements everywhere and hence have the Arduino "idle" and do nothing.

it takes a little to wrap your head around at first as things no longer happen in a linear fashion - so if you are used to writing output to an LCD screen and it just scrolling down as more text is added then you need to be careful.

What i initially did when converting my code was to take each of the functions that i had previously written and called from the Loop() and instead called each of them with a timer.

So if i wanted to take a temperature measurement every 30 seconds then put a call to that in a timer. Where is gets tricky is if something else is going to operate on the output of that function (say something that would average the temperature readings when they are taken) - in that case you need to put a little more thought into how those two functions would work together

Sorry I didn't have received notifications about your questions. But as I still develop my library, you may still interrested in the answers.

1- how do you handle interrupts in this model?2- if a task is running and another 'Alarms', is it started or delayed?3- how to handle Serial?

Interrupts are just happens. I do not modify any interrupt configuration in the Arduino. No hardware is involved in my solution, everything is implemented in the software.Generally say, when a hardware interrupt occurred, the processor "stops" at that point and the interrupt handler is called. After the handler finished, the program is resumed. This is why we must exit the interrupt handler as soon as possible, and mark the potentially modifiable variables with "volatile".

SoftTimer does not operate with software interrupts. We have tasks. Tasks are invoked after each other, at the time they are scheduled to run.

4- what is the Task *Me pointer?

This is a technical thing. It turns out that it is very hard to program nice object oriented code in Arduino, because we are not recommended to dynamically create objects. This is why I like to add the pointer pointing to the actual object "me" in the callback signature.

Your library runs fine on Arduino IDE 1.6.5 (under windows 10), but both on 1.6.13 and 1.8.0, when I try to compile the SoftTimer1Task example, I get the "CallBack1 was not declared in this scope message".

Your library runs fine on Arduino IDE 1.6.5 (under windows 10), but both on 1.6.13 and 1.8.0, when I try to compile the SoftTimer1Task example, I get the "CallBack1 was not declared in this scope message".