loop

hi all i am making this script where i type i and it will move a servo bye the light and o does the sweep
but it won’t loop

//Arduino Control
int delaytime = 0;
int spin;
int angle;
#include <Servo.h>
Servo myservo;
int ledPin =  13;    // LED connected to digital pin 13
int incomingByte = 0;	// for incoming serial data
int pos = 0;
// The setup() method runs once, when the sketch starts

void setup()   {                
   Serial.begin(38400);
  myservo.attach(11);
}


void loop()                     
{
  if (Serial.available() > 0) {
    // read the incoming byte:
    incomingByte = Serial.read();
    loop;
    if(incomingByte == 105){
      spin = analogRead(0);

  Serial.println(spin, DEC);
  {
      myservo.write(spin);
   
    }
    }
    else if(incomingByte == 111){
    
  for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
} 
     
    }
  }

I'm not sure what effect loop; inside loop() will have, but I'm surmising it'll just keep going back to the top of loop() every time it sees loop;.

I've never seen loop being called from inside itself before....

void loop()                     
{
  if (Serial.available() > 0) {
    // read the incoming byte:
    incomingByte = Serial.read();
    loop;  // ?????????????????????????????????????????????????
    if(incomingByte == 105){
      spin = analogRead(0);

  Serial.println(spin, DEC);
  {

I’ve never seen loop being called from inside itself before…

That isn’t calling loop. (good job too)
It’s just verifying that the function point “loop” is zero or non-zero, and then discarding the result.
All a bit pointless.

I tidied the code up (uncompiled, untested)

#include <Servo.h>
Servo myservo;

void setup()   
{                
  Serial.begin(38400);
  myservo.attach(11);
}

void loop()                     
{
  if (Serial.available() > 0) 
  {
    // read the incoming byte:
    int incomingByte = Serial.read();
    if(incomingByte == 'i')
    {
      int spin = analogRead(0);
      Serial.println(spin, DEC);
      myservo.write(spin);
    }
    if(incomingByte == 'o')
    {
      for(int pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 179 degrees 
      {                                  // in steps of 1 degree 
        myservo.write(pos);              // tell servo to go to position in variable 'pos' 
        delay(15);                       // waits 15ms for the servo to reach the position 
      } 
      for(int pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 1 degrees 
      {                                
        myservo.write(pos);              // tell servo to go to position in variable 'pos' 
        delay(15);                       // waits 15ms for the servo to reach the position 
      } 
    } 
  }
}

It’s just verifying that the function point “loop” is zero or non-zero, and then discarding the result.

Must confess, I have no clue what that means… what’s a “function point”?

Sorry "function pointer" - bloody auto-complete.

Well I never got as far as pointers so I still have no idea what that loop; in the middle of loop() is doing.

It's doing nothing, I just told you.

It's just like writing 42; in the middle of your code - it isn't syntactically wrong, just pointless.