Logic problems

Fixed previous error,

Now I'm having issue with interrupts.

I need to interrupt my servo when the button is LOW, I don't want to post my whole code, but unsure on what is needed and not, for the interrupt.

#include <Servo.h>  
Servo myservo;  // create servo object to control a servo 
int buttonPin = 3;               
int pos = 0;    // variable to store the servo position 
volatile int state = HIGH;

void setup() 
{  
  pinMode (buttonPin, INPUT);
  attachInterrupt(0, stop, LOW);
  Serial.begin(9600);
  myservo.attach(2);  // attaches the servo on pin 9 to the servo object 
} 
 
void loop() 
{ 
 while (digitalRead(buttonPin) == HIGH)
 { 
  for (pos = 0; pos < 180; pos += 1)
  {
   myservo.write(pos);              // tell servo to go to position in variable 'pos' 
   delay(15);    
   Serial.println(pos);
  } 
  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);  
   Serial.println(pos);     // waits 15ms for the servo to reach the position 
  } 
  digitalRead(state);
 }
} 

void stop()
{
  state = !state;
}

Change :

attachInterrupt(0, stop, LOW);

// to 

attachInterrupt(1, stop, FALLING);

Why ? 1 is pin 3, 0 is pin 2. LOW is not working well. I did that once. I change to FALLING or RISING. Work much better.

thats great, its finally sort of working. Now if only i can get it to stay off once I push the button.

thats a bit of software, in pure example form

byte oldbutton = 0
button = arduino pin number

if(!button && oldbutton)
{
oldbutton = 0
}

if(button && !oldbutton)
{
do something
oldbutton = 1
}

in a nutshell that should make a single shot button (though its late here and thats totally off the top of my head)

Now if only i can get it to stay off once I push the button.

Which button? If you used switches, instead, perhaps it would work.

You have a variable called state, that you toggle in the ISR. The only use of state in loop() is as a pin number. Why?