Pages: [1] 2   Go Down
Author Topic: Blink does not blink...  (Read 5359 times)
0 Members and 1 Guest are viewing this topic.
Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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:
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:
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...
Logged

0
Offline Offline
Sr. Member
****
Karma: 4
Posts: 310
Posts: 40382
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6137
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.

Quote
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?
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It sounds to me like the delay function isn't working, which suggests interrupts are not working. Please post your whole code.
Logged

Colorado
Offline Offline
Full Member
***
Karma: 2
Posts: 220
Arduino 0022 and Ubuntu 11.10 64bit.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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) 2.20.1.20100303"
« Last Edit: March 29, 2011, 02:57:02 am by mrtaylor » Logged

Portugal
Offline Offline
Edison Member
*
Karma: 37
Posts: 1545
Pretending you know everything then you will learn nothing.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
http://www.arduino.cc/playground/Linux/Ubuntu
It should be similar of your distro
Logged

Debian,Mint,Ubuntu
Arduino Mega 2560
Arduino Nano
Arduino Duemilanove
MAC OS Montain Lion
Raspberry PI Model B


Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

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

Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Colorado
Offline Offline
Full Member
***
Karma: 2
Posts: 220
Arduino 0022 and Ubuntu 11.10 64bit.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you seen this?
https://wiki.archlinux.org/index.php/Arduino
Logged

Viterbo
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
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?

Bye,
Ivan
Logged

I believe in Fairies smiley

Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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??
Logged

Viterbo
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

I believe in Fairies smiley

Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1295398984

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:
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:
100
6616
19124
33720
48312
62908
77504
92100
106696
123376
140056
156736
173412
190096

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 ".
Logged

Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
92
4368
16880
31472
46068
60664
75260
89852
104456
121128
137808
154488
171168
187848
204528
221208

..indicating that micros() works.
Logged

Pages: [1] 2   Go Up
Jump to: