Arduino Mega 2560 exit status 1

I am very new to programing and playing with Arduino. I finally got this program to have no errors on Verify. So I try uploading it to the board and I get the error below

/*Programming Logic

Assign an array of nine photo cells as follows:

0              1              2             

3              4              5             

6              7              8   */

int cells[9];
int b;
int now;

// read values into array and display them

void setup(void) {

  // We'll send debugging information via the Serial monitor

  Serial.begin(9600);  

}
//int b;

void bright(void)
{
  for(now=0; now<9; ++now)
  {  
    b=analogRead(now);
    
   cells[now]= b; 

   Serial.print("Analog reading = ");


 
   Serial.println(b);}

 // delay(100);



//this may not be all that is needed to display them?  %D maybe

// Scan all and find brightest: 

b = cells[0];

for (now=1; now<9; now++) 
{
  if( cells[now]> b) b = cells[now];



   Serial.print("brightest = ");

  Serial.println(b);

}
}
/*
If brightest=4 then movedelay else
If brightest=1then movedr
If brightest=2 then moved
If brightest=3 then movedl
If brightest=4 then mover
If brightest=6then movel
If brightest=7 then moveur
If brightest=8 then moveu
If brightest=49then moveul end else
*/

This is the error. I haven't had any luck with poking through the settings. Advice will be welcome. Please and thank you.

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Users\SIMULA~1\AppData\Local\Temp\cchvSO4S.ltrans0.ltrans.o: In function `main':

cchvSO4S.ltrans0.o:(.text.startup+0x14a): undefined reference to `loop'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.
Invalid library found in C:\Users\Simulator\Documents\Arduino\libraries\Solar_cell_test: C:\Users\Simulator\Documents\Arduino\libraries\Solar_cell_test
Invalid library found in C:\Users\Simulator\Documents\Arduino\libraries\Solar_cell_test: C:\Users\Simulator\Documents\Arduino\libraries\Solar_cell_test
Invalid library found in C:\Users\Simulator\Documents\Arduino\libraries\Solar_cell_test: C:\Users\Simulator\Documents\Arduino\libraries\Solar_cell_test

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Also, if this is in the wrong area, I am sorry

Where is your loop() function?

.

larryd:
Where is your loop() function?

.

I said I was very new.. I shall start looking on how to make one.

See:

Right now, I just want it to run once and stop.
The board has a bunch of photocells and want it to tell me which one is the brightest.
The Right now I want to get it on the board to make sure it works.
Once I have the rest of the parts in, I will put the loop in.
My biggest problem is trying to get it onto the board

You need a loop function even if it is empty.

void loop()
{
//this loop function is empty.
}

Edit
You need to 'call' bright(void) in setup() if you want to run it once.

larryd:
You need a loop function even if it is empty.

void loop()
{
//this loop function is empty.
}

Edit
You need to 'call' bright(void) in setup() if you want to run it once.

With that, it should be able to go onto the board?

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Users\SIMULA~1\AppData\Local\Temp\cchvSO4S.ltrans0.ltrans.o: In function `main':

cchvSO4S.ltrans0.o:(.text.startup+0x14a): undefined reference to `loop'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

Post your new code

evanmars:
Post your new code

larryd:
You need a loop function even if it is empty.

void loop()
{
//this loop function is empty.
}

Edit
You need to 'call' bright(void) in setup() if you want to run it once.

The loop worked.. it's on the board ^.^

:slight_smile:

larryd:
:slight_smile:

Now onto how to get it to print on screen.