Arduino-Uno
http://playground.arduino.cc/Code/Timer
Hi all,
I'm having issues trying to trigger the t.oscillate (or any of the functions in the 'timer' library) in an if statement. Currently they just run regardless of how I try and segment the timer function from the loop. As in the LED will blink at 1 second regardless as soon as the oscillate function is included ANYWHERE in the code.
I'll look into using millis() function BUT I find the timer library very easy to use apart from this triggering issue.
Ultimately I would like to have fan running at different on/off times depending on mode I set (e.g 10 sec on then 10 sec off, 1 minute on then 1 minute off) hence the use of a mode triggering variable.
As this is my first post, please excuse any broken rules or lack of clarity in my post.
And thanks in advance for any replies.
Tim
#include <Event.h>
#include <Timer.h>
Timer t;
int testPin = 13;
int mode;
int ledEvent;
void setup()
{
pinMode(testPin, OUTPUT);
//int ledEvent = t.oscillate(testPin,1*1000,LOW); //5 seconds
}
void loop()
{
int mode = 0;
t.update();
if(mode = 1)
{
oscillation();
}
}
void oscillation()
{
t.oscillate(testPin,1*1000,LOW);
}