Go Down

Topic: Blink does not blink... (Read 11118 times) previous topic - next topic


Hi all,

I just started with Arduino, so probably I'm doing something wrong....
I installed the arduino software on my (Arch) Linux PC. When I connected my Arduino Duemilanove for the first time to a USB-port, the "L" led started flashing. So it worked.
After that I compiled the sketch under file -> examples -> 1.basics -> Blink and tried to upload this to the Arduino. After a short flashing of the TX and RX leds the L led goes on, and stays on.
If i change the order like this:
Code: [Select]
void loop() {
  digitalWrite(13, LOW);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, HIGH);    // set the LED off
  delay(1000);              // wait for a second

and compile and upload, the L led stays off.
Holding the Shift key during the upload gives the following output:
Code: [Select]

Binary sketch size: 1020 bytes (of a 30720 byte maximum)
/usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -v -v -v -patmega328p -cstk500v1 -P/dev/ttyUSB0 -b57600 -D -Uflash:w:/tmp/build7976589511234931586.tmp/Blink.cpp.hex:i

avrdude: Version 5.4-arduino, compiled on Oct 22 2007 at 13:15:12
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "/usr/share/arduino/hardware/tools/avrdude.conf"
         User configuration file is "/home/ko/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port            : /dev/ttyUSB0
         Using Programmer      : stk500v1
         Overriding Baud Rate  : 57600
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
         AVR Part              : ATMEGA328P
         Chip Erase delay      : 9000 us
         PAGEL                 : PD7
         BS2                   : PC2
         RESET disposition     : dedicated
         RETRY pulse           : SCK
         serial program mode   : yes
         parallel program mode : yes
         Timeout               : 200
         StabDelay             : 100
         CmdexeDelay           : 25
         SyncLoops             : 32
         ByteDelay             : 0
         PollIndex             : 3
         PollValue             : 0x53
         Memory Detail         :

and many more lines, ending with:
Code: [Select]

avrdude: verifying ...
avrdude: 1020 bytes of flash verified
avrdude: Send: Q [51]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]

avrdude done.  Thank you.

...which looks o.k. to me...

Big Oil

make sure you did all the correct steps for linux: http://www.ladyada.net/learn/arduino/lesson0.html
Use a current limiting resistor (1000 ohms) before the led to make sure it doesn't burn out.

I installed with Linux a while ago and version 17 of the software would work, not later versions, though they have probably fixed that by now.


Use a current limiting resistor (1000 ohms) before the led to make sure it doesn't burn out.

Since Pin 13 is being used, there is already a current limit resistor there.

If i change the order like this:

What happens if you change the order back and upload again?  It might be helpful to post your entire code (even if that is the only part you changed.)

What version of the Arduino IDE you are using?
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com


It sounds to me like the delay function isn't working, which suggests interrupts are not working. Please post your whole code.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics


Mar 29, 2011, 09:36 am Last Edit: Mar 29, 2011, 09:57 am by mrtaylor Reason: 1
I seem to remember a bug in a version of avr-binutils causing the delay function not to work correctly. You can check the version by executing the command "avr-as --version".  I version I use on my machine is  "GNU assembler (GNU Binutils)"


I have a similar case (using UBUNTU 10.10)
You need to install arduino via synaptics and then update that version since the synaptics install version 0018
Then to update to the last version of arduino use this tuturial
It should be similar of your distro
Arduino Mega 2560
Arduino Nano
Arduino Duemilanove
MAC OS Montain Lion
Raspberry PI Model B



Thanks for all responses. Wow! this really is an active community!  :D I'll try your suggestions one by one; maybe also install the Arduino software on Windows.


I can confirm that my Duemilanove works in Windows XP. I can upload the 'Blink' sketch there, make it work, change, upload again etc. So there's obviously something wrong with the installation in Linux. There don't seem to be very many Arch-Linux users working with Arduino.
I'll have a look at your suggestions.


i have the same problem with arduino uno (i'm using arch linux too).
For the arduino ide seems that the upload was succesfull.
In windows Vista everything works fine.

I'm wondering if the solution to that problem is that: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1286088093/34#34
Anyone can confirm that?



To: mrtaylor and Nick Gammon:

I can confirm that the problem is in the delay() function. I've found this sketch: http://arduino.cc/en/Tutorial/BlinkWithoutDelay; compiled & uploaded it, and it works: BlinkWithoutDelay really blinks!

To: finarfin:

I don't get what you mean with the link. It seems to point at a Ubuntu-discussion??


It seem that there are problems with arduino uno and linux. And this discussion if you checked in archlinux wiki is indicated as a possible solution for problem encountered uploading sketch.


I see what you mean, now. But I don't have an Arduino Uno; mine is Duemilanove. The serial interface chip is a FTDI??? and not Atmel 8U2.


This seems to describe a very similar problem, so you are not alone:


I am not a Duemilanove expert, as I don't have one, nor am I using Arch Linux. So anything I may say here will be guesswork. Probably someone else can offer better advice.

What I would do first is try to find a Mac or Windows PC, and upload the sketch with that. This eliminates problems with the board, its interrupts, and the bootloader.

If that fixes it then it would seem that the "core library" uploaded alongside your sketch is not handling delays properly.

As far as I can see, delay is implemented by looping waiting for micros () to return a value indicating the delay time is up. So the question is, does micros () work for you? This sketch might test that out:

Code: [Select]
void setup() {               
  Serial.begin (4800);

void loop() {
  Serial.println (micros ());

Set your serial monitor to 4800 and run the sketch. In my case I got this:

Code: [Select]


But if you find the number does not increment, then the micros is faulty (probably because interrupts are not firing) and thus delay will loop forevever. How to fix? Try upgrading your version of the IDE (development environment). Try searching for "blink delay +Duemilanove ".
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics


Hi Nick,

I already eliminated problems with the board, etc.: it works in Windows XP (see my previous post).
I tried your sketch, and captured this output in the serial monitor:

Code: [Select]


..indicating that micros() works.

Go Up