[SOLVED]Problems with triggering timer functions in 'if' staments

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);
  
}
  if(mode = 1)

= is the assignment operator
== is the comparison operator

sigh thankyou so much, simple fixes. I'm still just learning so cheers for letting me know that.

I can fully understand your sigh
The =/== confusion must be one of the most common mistakes to make. = is used either accidentally or on purpose because of familiarity with other languages and of course, the code compiles either way so you don't get any immediate indication of the problem.

If only the compiler could understand what you meant rather than what you wrote.