for loop to index arrays


i can't seem index array using index of loop.

the following code works fine, printing "65" serial:
code: [select]
void setup()
{
 serial.begin(9600);
}

void loop()
{
 int test[480];
 for(int i=0; i<480; i++)
 {
   for(int j=0; j<57; j++)
   {
     test[479] = 65;   // line 13
   }
 }
 serial.println(test[479]);
}

however if change line 13
code: [select]
test[i] = 65; no longer on serial.

what wrong?

edit: nevermind. appears working fine now, @ least in test case. not sure wrong before. i'll leave in case there this...

you have run out of memory! test array consumes 960 bytes , arduino doesn't have available.




Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > for loop to index arrays


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums