Duemilanove 20sec Interrupt/Timeout


I am very new to Arduino. I use the USB cable as power supply. For a test, i turn an LED connected to pin12 on. After EVERY 20 seconds, the LED turns off ... and the rX led on the board blinks a few times before the led on pin12 starts again (it seems like the code is resetted .. or somehow interrupted) ...

I really wanna know whats happening .. and how can I prevent this timeout/interrupt/reset (i dont know which term should i use).. Any help or insight would be appreciated .... below's the code ..... i've wrote a couple of other demos .. but they all get interrupted around the same time (20secs)... wondering if this is anything to timer0 ???

int pin12 = 12;

void setup() { pinMode(pin12, OUTPUT); }

void loop() { digitalWrite(pin12, HIGH); }

Do you have a resistor with that LED? It sounds like the LED is by itself, which is drawing too much current, causing the Arduino to shut off. It then restarts, and runs again until the current limiter kicks in again.


Yes, I didn't use any resistors!! So i tried this:

added a resistor between pin12 and the longer leg of LED. Tried with 220Ohm, 1Kohm and 10KOhm resistor... THe output was the same... after some time, the code would reset or interrupted..

I tried the other way round, a resistor between the ground and the shorter leg of the pin with all the above resistors respectively. Yet, same result...

Question1: should the resistor be between pin12 or gnd (thats suppose to be pull-up and pull down resistor if not mistaken)

Question2: Is it because of USB as power source. . the rx led on board blinks while the circuit resets .. why do i have a feeling its something to do with interrupts caused by the pc USB port??

Tell us about the host computer. What is the operating system? What programs are running when you perform the test? Do you have a PDA connected to the computer?