Hi everyone my arduino is doing somthing weird

Thomas499:
few lines less than what you had. I don't know why people like typing so much when they only have to write it once

You still left this error in there:-if(cond){
And if we're shortening things, instead of these:-

i=i+10;
.
i=i-10;

These:-

i+=10;
.
i-=10;

You're typing too much too. :smiley:

And we can save a couple more characters of typing by leaving out some braces:-

while (j<1000000000ul)  // Not sure if "ul" is absolutely necessary, but it can't hurt.
{
    j++;
    if(cond())
        i+=10;
    else
        i-=10;
    analogWrite(batc,i);
    delay(1000);
}
break;