# 3 servo motor control driving fault in while(1) infinite loop

Hello guys, I am programming my arduino to control a robot arm. In one part of code, I want 3 servo motors position sweeping between 30 to 60 degrees all the time. So my code enters in a "while(1)" infinite loop. But the thing is that motor positions change just once, although it is in an infinite loop Everything seems ok but i dont know why it doesnt alwyas change between 30-60-30-60... Relevant part of code is;

`````` while (1)
{  result = delta_calcInverse(0, 0, -255, t1, t2, t3);//here i calculate the first  motor positions
servoWriteFloat(&servo1, t1); //write angles value into the servo
servoWriteFloat(&servo2, t2); //write angles value into the servo
servoWriteFloat(&servo3, t3); //write angles value into the servo
delay(5);
result = delta_calcInverse(0, 0, -210, t1, t2, t3);//
servoWriteFloat(&servo1, t1); //write angles value into the servo // here i calculate the second motor positions
servoWriteFloat(&servo2, t2); //write angles value into the servo - the 10 value is due to not perfect alignement of the servo
servoWriteFloat(&servo3, t3); //write angles value into the servo - the 5 value is due to not perfect alignement of the servo
delay(v);
if (Serial.available() > 0) {
if (tempo='B') {
break;
}
}
}
``````

That code will wait forever for SerialAvailable, I think...

Nope, it is in "if", so if tehre is no data in buffer it should turn back to start of while again.. btw i also tried it, i removed that part but still did not work.. I am sure that the loop function is working because I put "Serial.println(v)" just after "delay(v)", it always send "v" value to computer.. so it shows loop is working

Shouldn’t
if (tempo=‘B’)

be
if (tempo == ‘B’)

Lefty