Noch ein Hinweis:

int i=0;
for (i=0;i<100;++i)

Wer dies im C++-Stil programmieren will, also

for (int i=0;i<100;++i)

muss einfach als Compilerflag -std=C99 einfügen. So etwas geht beim AVR Studio allerdings nur manuell, also keine Combo-Box zur Auswahl.