hoke-t / arduino-timerone

Automatically exported from code.google.com/p/arduino-timerone
0 stars 0 forks source link

led blink #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello, 

I was try to make the pin 13 to blink every 1/2 sec and i was use the bellow 
code without success, can you please tell me what is the mistake ?

#include <TimerOne.h>

#define led 13

boolean x = false;

void setup()
{
    pinMode(led,OUTPUT);
    Timer1.initialize(1);
    Timer1.attachInterrupt(myint);

}

void loop()
{
    digitalWrite(led,x);

}

void myint()
{
    x!=x;
}

Original issue reported on code.google.com by tasos...@gmail.com on 13 Dec 2011 at 5:55

GoogleCodeExporter commented 9 years ago
Please read the documentation @ http://arduino.cc/playground/Code/Timer1

Timer1.initialize() takes a value in _microseconds_, so a value of 1us may 
force the processor into a infinite interrupt loop or it might just go blink a 
million times faster than you wanted.  Also, the digitalWrite should be in the 
myint section.

Original comment by lex.v.ta...@gmail.com on 1 Feb 2012 at 3:23