"delay" provoked error

Hello.

I have a problem with "delay" function:

//Reads analog noise in A0 every 200ms
//and stores it in EEPROM array,1024 values

#include <EEPROM.h>

void setup() {
pinMode(13,OUTPUT);
}
void loop() {
int i=0;
while (i<1024){
digitalWrite(13,HIGH);
delay(100);
EEPROM*=analogRead(A0);*

  • i++;*
  • digitalWrite(13,LOW);*
  • delay(100);*
  • } *
  • }*
    -----------------------------------------------------------------
    ERROR:Arduino:1.6.13 (Windows XP), Tarjeta:"Arduino/Genuino Uno"
    collect2.exe: error: ld returned 5 exit status
    exit status 1
    Error compilación en tarjeta Arduino/Genuino Uno.
    -----------------------------------------------------------------
    The program runs perfectly when removing "delay" functions but I need them.
    Some idea?

Your problem is nothing to do with Delay. Take a look in the reference examples for using the EEPROM - you'll need to use the write method. EEPROM is a class, not an array.

Please use code tags when posting code. I'm sure that you did not type your code partially in italics in thr IDE :smiley:

You can edit your post and

Type

[code] before the code.
Type [/code]

after the code.

I suspect that "collect2.exe: error: ld returned 5 exit status" means you are using a version that doesn't work on Windows XP. A Google search for "ld returned 5 exit status" will point you to a bunch of pages and even YouTube videos in multiple languages.

I apologize.
It was my first entrance in this forum.
I will intend to respect the norms.

The first code has an error. It was:

.....
      delay(100);
           EEPROM[i]=analogRead(A0);
.....

I repete, without "delay" finctions it runs perfectly and next I am able to read the analog noise written in EEPROM with another program.

I tryed with the next code:

.....
   delay(100);
     EEPROM.write(i,analogRead(A0));
.....

...The same error occurs and without "delay" finctions it runs perfectly.
It is the furst time I have a problem with "delay" function.
I need "delay" becauce I am going to put "delay(3600000)" for one hour waiting.
I tryed it and there is no compilation error becauce of 3600000.

I have just fixed it. I have added "Serial.begin(9600)" into the "set up" block and that is all.
I read it in another forum.

I have just fixed it. I have added "Serial.begin(9600)" into the "set up" block and that is all.
I read it in another forum.

Please post the code which requires Serial.begin() in set up to write to the EEPROM.

cattledog:
Please post the code which requires Serial.begin() in set up to write to the EEPROM.

This is the "collect2.exe: error: ld returned 5 exit status" type error that happens on Windows XP. The sketch contents as such are irrelevant. Any change can make it come and go. A more predictable and permanent way to fix it is to run Arduino in Windows 2000 compatibility mode.

Thank you, oqibidipo.
I deleted the nothing to do"Serial.begin(9600)" line and I started Arduino in
Windows 2000 compatibility mode. The program goes perfectly.