Show Posts
Pages: [1]
1  Using Arduino / Installation & Troubleshooting / Re: LED Blink Program Weirdness on: August 06, 2011, 09:16:54 am
The problem only exists when no global variable is defined or used.  At least that is what I determined from the other threads. Adding a fake non-zero global, and using or incrementing it, fixes the problem.

Blink is the only example that is simple enough to not actually use a global variable!
Just enabling serial communications, is also enough to create a global variable.

I agree that it is a shame that Fedora has this fault.

Debian has a patch in its packages, which is why your unbuntu linux works.   The upstream provider however has not fixed it, or if they have, that fix has not made it into the fedora package repository.

2  Using Arduino / Installation & Troubleshooting / Re: LED Blink Program Weirdness on: August 05, 2011, 03:16:39 am
No.  The solution is some type of patching of avr compiler packages.  There is no word if the upstream providers known and/or have fixed the problem, which has now spread to Fedora 14 packages.

The work around is to create a initialised global variable that is actually used in setup() or loop().  Basically any form of added complexity, will generally avoid the problem.

It is not good but it explains the weirdness.


The best intermediate idea may be to update that 'blink' example on the primary web site, to use a global variable, such as the 'blink' example distributed with the arduino GUI v22 software.  That way other new users do not accidentally hit the problem in the first place!

3  Using Arduino / Installation & Troubleshooting / Re: LED Blink Program Weirdness on: August 05, 2011, 02:28:37 am
The problem may be related to the linux compiler problem described in
  http://arduino.cc/forum/index.php/topic,49900.0.html

It is also looked at in these topics, which also point back to the one above.
  http://arduino.cc/forum/index.php/topic,68456.0.html
  http://arduino.cc/forum/index.php/topic,51000.0.html
4  Using Arduino / Installation & Troubleshooting / Re: Arduino Mega 1280 delay() turbocharged on: August 05, 2011, 02:16:49 am
Ditto for Fedora 14, with Arduino Duemilanove.
See topic
  http://arduino.cc/forum/index.php/topic,68512.0.html

However the 'blink' example that comes with the arduino v22 software, initializes a LEDPin global variable and that, as has been said fixes the problem.

I am a newbe to using the arduino, and the fact that it fails like this with a very basic example has been a worry for me.   Any idea when the real problem will be fixed?
5  Using Arduino / Installation & Troubleshooting / Re: Function Delay on: August 05, 2011, 01:59:16 am
I just found this topic. and it seems to be similar to the problem I just posted...

http://arduino.cc/forum/index.php/topic,68512.0.html

6  Using Arduino / Installation & Troubleshooting / LED Blink Program Weirdness on: August 05, 2011, 01:56:06 am
I was given a Arduino Duemilanove, which looks exactly like the board shown in "The Arduino Playground"
  http://arduino.cc/en/uploads/Main/ArduinoDuemilanove.jpg
right down to the "RESET-EN" trace, and the text between 'MADE IN ITALY' and pin13.  So I started to play just the board (not extra electronics or external power) connected to my Dell Laptop running Fedora 14, with the arduino 0022 software installed.

Now I tryed the 'LED Blink' sktech from the web site, but all I even got after the program was uploaded to the arduino was a solid unblinking LED!
  http://arduino.cc/en/Tutorial/Blink

However other example sketches (mostly serial communications) worked fine, including 'PhysicalPixel' where you send the arduino 'H' and 'L' characters to turn on and of the LED!  Just the LED blink sketch fails to do what it what it is supposed to do!   Playing with the delay() values would sometimes result in the LED flashing breifly then just turning off, but typically the LED would just be a steady on with no other action.

Then I tried a different 'Blink' the LED example from the 0022 adruino 'examples' sub menu.
IT WORKED!

The only difference between the two is that instead of using a integer value of 13 directly as on the web site, the working example used a variable to hold that integer value of 13.  They were functionally equivalent!

So after some playing with the code, this is what it came down to.

This failes  (solid on board LED after uploading)
Code:
/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */

int L3 = 13;
void setup() {               
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);     
}

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);              // wait for a second
}

But this works (change a '1' to a 'L' in setup() )
Code:
/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */

int L3 = 13;
void setup() {               
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(L3, OUTPUT);     
}

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);              // wait for a second
}


In other words, if I do the setup of the pin using a variable it works, but fails if I use a number directly.
No change was made to loop(), just the use of the variable in setup()
In the compiled 'C program' this should make no difference to the call structure, only adding a 'retrieve variable contents' before the actual call to the pin setup library function. Both should be seting a integer value to the library function. The two programs should be functionally equivalent, but that is not what happens!

In fact this small difference is reflected in the upload code sizes...
Using '13' directly creates a code size of  1020 bytes
Using a variable, (any name, though I used L3 for the test for ease of editing) I get a code size of 1024.

The 4 extra bytes would be the machine code to 'retrieve value from memory'.  Note that the code size going from 1020 (fail) to 1024 (success) is very suggestive, though I have not tried to played with that fact.

ASIDE:I am not a novice in programming or electronics, just a novice with the arduino!
I was programming in Z80 CPU machine language (ZX81) in the 1980's after all!
 
I have no idea why this small change causes it to fail/work.  My only thoughts on this is that...
* I am hitting a bug either in compiled code
* or in the specific hardware I am using,
* or perhaps it is the upload code (code size less than 1Kbyte)
and  as a result of whatever it is, the arduino is crashing during setup, before it gets to loop().

It will be hard to figure out too as any change, such as adding "Serial.begin(9600);" to the setup() makes the sketch work again!



Does anyone have any suggestions as to why one sketch works and the other does not?  If you give me some instructions I am also willing to go to a deeper level and upload the compiled code, or even assembly language to see what is the real difference.

Another user on the forum tried both the stetches his arduino, though it wasn't the same model as mine, and he said they both work!

Would others with a Arduino Duemilanove (especially if you have one with the 'RESET-EN' trace on the board next to the USB input), please try and see if they can get similar results?
7  Community / Website and Forum / Re: Loop Back Test - Sticky? on: August 05, 2011, 01:24:51 am
That'll teach me to open my big mouth.

Yes you have to be careful it doesn't get so complex you need a flow chart. How about

Quote
5. Connect the board to your computer.  After a brief pause Windows will produces a device-insertion tone if sound is enabled.  Linux may or may not produce a device-insertion tone; an entry is added to the system log.
_____
Rob

You may also like to add that under linux a new /dev/ttyUSB*  device driver will appear.

The reason is that on (at least fedora or redhat) linux  the 'messages' file is root only readable for security reasons.  where as the existence of a new device driver is something any user can check on.  Basically it is a more convenient thing for a user to look for.

Also note that users will need to be members of the right groups to enabled locking for serial communications. That is something that is noted in the web sites software installation and setup page. The step-by-step instructions however can just point to the right web page for that sort of detail.
8  Community / Website and Forum / Re: Web site missing Newbe information on: August 05, 2011, 01:07:41 am
Finanly I finally found what was missing on the web site in the form of...
  Lady Ada's Arduino Tutorial
    http://www.ladyada.net/learn/arduino/index.html

That web site could use some updates, but it was essentially what I was looking for, a step-by step guide to getting started with using the arduino for the first time and probably should be added to the "Getting started" Web page.

As for my 'led blink'  problem.  Well it has taken a really strange twist, in that what is essentially equivalent code, working in one case but not the other. I will now post the specific problem in Trouble shooting.

Thanks for PaulS for his help.
9  Community / Website and Forum / Re: Loop Back Test - Sticky? on: August 03, 2011, 05:04:26 am
Thanks for the answer.

And you are right about it being in the hardware board section.

Newbe -- just finding my way!
10  Community / Website and Forum / Re: Web site missing Newbe information on: August 02, 2011, 06:36:05 pm
No I did not.  That was not very obvious at all!

I did notice a number of times links to specific board information but my board was not listed!

In fact it is not even listed on that hardware page either!  It looks line the 'Uno' picture on the hardware page you pointed out, but is a  Arduino Duemilanove, which the Uno description says it is similar to!

That can be added to the 'first steps' or "assumed information" page that is needed on the web site.


Now that I finally 'learned' that an external power supply is not needed to at least initially 'play' with the device,
I plugged it in to the computer.

The 'L' light was flashing in a 1 second on/off cycle, so I assumed the person who gave it to me (gift) had already run a 'led blink' program.   I selected the right serial port, and up loaded a 'led blink' sketch with a slightly faster cycle (1/2 second).  Finally confident I knew what I was doing.

The Tx/Rx lights flash, and then the the on board 'L' goes solid, no more blink!
Arrgghhh...   Have not been able to get any further than that,  not errors in GUI
But that is now beyond 'basics', and I'll work through troubleshooting for it.
11  Community / Website and Forum / Re: Loop Back Test - Sticky? on: August 01, 2011, 10:48:36 pm
The connect power of the arduino was crossed out in the instructions above.
Does that mean the arduino does not need an external power supply when just the base unit is plugged into the computer?

It is not mentioned anywhere on the web site!
12  Community / Website and Forum / Re: Web site missing Newbe information on: August 01, 2011, 10:43:46 pm
The ideal place for this initial information would probably added to the led 'blink' sketch, seeing as that is the first fundamentals pointed to.  Just something is needed  as a 'first steps' guide, between software and first sketch!  Does not have to be much either, just the initial stuff that is 'obvious' to anyone who has already used it, but not 'obvious' to something who hasn't!

There is a very sharp 'first step' for a beginner to to get over.  I think most would have a friend or workshop class to get though it, but it is just something the web site should cover.

One point I finally was able to answer after a search, whcih would be useful for that first step guide, is that no external power is needed for just that first led blink' sketch.  If I knew that before I would have been able to start immediately, rather than having to wait until I can get a external power supply from elsewhere!  Arrgghhh....


Fair enough for the command line stuff, though a summery of the commands on say the "environment" page would be useful, at least as a starting point.  Especially to run "arduino" to start the GUI.  I still haven't found it mentioned anywhere, not even the software install page as a 'test'.  I only figured that out by trial and error!

Actually I was surprised that this first 'blink pin 13 led' sketch did not seem to be in the GUI library!  The one called 'blink' in the GUI is for a larger LED display, not just the on board led.

13  Community / Website and Forum / Web site missing Newbe information on: August 01, 2011, 06:00:23 am
Greetings from a arduino newbe,
Note I am not a newbe with programming, computing, nor a newbe with basic electronics, just with arduino.

I was just given an arduino, and told to look at the web site.

Well the web site is great.  Software download/install instructions was good (simple yum install to a fedora system), as is the first basic 'sketch' (funny name when their is no diagram with them!) known as 'blink' (to blink the onboard LED).

But what is really missing is the step between these two.  That is the how to guide to start the software, and actually setup and run it.  For example.

Do you have to plug in a power supply or can it run of the USB, for at least that first 'sketch'?
What do you do to run that first sketch?
Also the GUI sucks, and I would prefer to use my own editor, but how do you do things without the GUI, from the command line.
If fact what are the commands that you can use?

These are sort of very very basic things that any newbe that has a 'clue' needs to know, but is not listed anywhere I've been able to find on the web site.

Basically a simple basic page that goes between 'download software' and 'learning the first sketch'.

Hopefully someone can at least point me to this basic info!
Pages: [1]