Also - if i comment out both delay(), then it runs ok even with led commented out (only all leds are blinking so fast, that they look just dimmed)
also if i use my own delay, it works ok everytime
void delay2(int d) { //does some delay, do not care about correct timing
volatile int a; // do not want be optimized out by compiler
for (int i=0;i<d;i++) {
for (long unsigned l=0;l<0xFFF;l++) {
a=d; // do not want be optimized out by compiler
}
}
}