biotech:
Please someone tell me what I´m doign wrong with the code.I already changed if ( i=0) for if ( I==0) but still doesn´t work. The if statements should be in a different place or something, but I don´t know where.
Did you also remove the semicolon?
The name, i, is pretty dumb. That name tends to be used a lot for for loops, etc. Global variable names should almost never be one letter names.
A name like turnLeft, with boolean as the type, and true or false as the values, makes more sense:
bool turnLeft = true;
Then, in loop():
if(turnLeft)
{
// turn left
turnLeft = false;
}
else
{
// turn right
turnLeft = true;
}