# 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) {
Â  Â  Â  Â  Â  Â  Â   tempo=Serial.read();
Â  Â  Â  Â  Â  Â  Â   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