two Limit switches in 360 servo

Hi Good morning.

I would like to ask about the limit switch?

I was working for 360 continuous servo with a two limit switches and I want to stop it with every position. because I was doing a final project.

I have to put my two limit switches in the 360 servo.

in the First station " initial position" there are two limit switches standby.

the first limit switch it will stop in every position or station because I want to stop it in 7 station.

and then when it hit to second limit switch it will go back to initial position.

I will show you my codes:

#include <Servo.h>

int x = 0;
int y = 0;
int limitIN = 7;
int limitOUT = 8;
int buttonstate = 0;
int buttonstate1 = 0;
Servo myservo;
void setup() {
Serial.begin(9600);
// put your setup code here, to run once:
pinMode( limitIN, INPUT );
pinMode( limitOUT , INPUT );
myservo.attach(9);
myservo.write (90);

buttonstate = digitalRead (limitIN);
if (buttonstate == 0) {
while (buttonstate == 0) {
buttonstate = digitalRead (limitIN);
myservo.write (80);

}
myservo.write (90);
x = 1;
y = 0;
}
Serial.println (“done”);
}

void loop() {

buttonstate = digitalRead (limitIN);
buttonstate1 = digitalRead (limitOUT);
// Serial.println (buttonstate);
//delay (50);
// Serial.println (limitOUT);

//}

//while (buttonstate1 == 0);
//{
// buttonstate = digitalRead (limitIN);
// myservo.write (85);
//
// }
// myservo.write (90);

}

Is there a question here?

The vast majority of continuous servos do not move to a position. The only thing you can do is to make it run in one direction or the other. Is your servo different?

and I want to stop it with every position. because I was doing a final project.

In what way would the requirement change if you were not doing a final project?

Post a link to the specification of the particular servo you are using so we have a better idea of what you're describing.

Your code doesn't do anything at all with the limit switches so you need to at least make some attempt at doing whatever it is you want. Then tell us what it does and what you want it to do different.

How do you expect that only two limit switches will allow you to recognise 7 different positions?

Steve