Servomoteur problème d'arrêt pour un serveur web

J'ai pour but dans un projet de faire fermer et ouvrir un volet avec un servomoteur sur un serveur web
Sauf que j'ai un problème lors de la rotation du moteur, celui-ci tourne en continu.
Vu que je débute sur arduino j'ai beaucoup de problème a résoudre cette erreur.

Voici mon programme:

#include <Ethernet2.h>
#include <EthernetClient.h>
#include <EthernetServer.h>
#include <EthernetUdp2.h>
#include <SPI.h>
#include <Servo.h>
int led = 4, role = 2

;
Servo microservo;
int pos = 0;
byte mac[] = { 0x90, 0xA2, 0xDA, 0x10, 0x2E, 0x98 }; //physical mac address
byte ip[] = { 10, 134, 97, 13 }; // ip in lan (that's what you need to use in your browser. ("192.168.1.178")
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(80); //server port
String readString;

void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
pinMode(led, OUTPUT);
pinMode(role, OUTPUT);
microservo.attach(9);
microservo.writeMicroseconds(1500); // mettre le servomoteur à l'arrêt (1500 = 1.5 ms)
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}

void loop() {
// Create a client connection
EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();

//read char by char HTTP request
if (readString.length() < 100) {
//store characters to string
readString += c;
//Serial.print(c);
}

//if HTTP request has ended
if (c == '\n') {
Serial.println(readString); //print to serial monitor for debuging

client.println("HTTP/1.1 200 OK"); //send new page
client.println("Content-Type: text/html");
client.println();
client.println("");
client.println("");
client.println("<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">");
client.println("");
client.println("<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css\">");
//
client.println("<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css\">");
//
client.println("<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js\"></script>");

client.println("Sécurisation automatique d'une maison individuelle");
client.println("");
client.println("");
client.println("");
client.println("

Commande de la maison sur Arduino

");
client.println("
");
client.println("
");
client.println("

Gestion de la maison

");
client.println("

");
client.println("<a href="/?button1on" class="btn btn-success">Allumer la lumière");
client.println("<a href="/?button1off" class="btn btn-danger">Éteindre la lumière");
client.println("
");
client.println("
");

client.println("
");
client.println("
");
client.println("<a href="/?button2on" class="btn btn-primary">Ouvrir les volets");
client.println("<a href="/?button2off" class="btn btn-primary">Fermer les volets");
client.println("
");
client.println("
");
client.println("
");
client.println("
");
client.println("
");
client.println("
");
client.println("
");
client.println("
");
client.println("");
client.println("");
client.println("");

delay(1);
//stopping client
client.stop();
//controls the Arduino if you press the buttons
if (readString.indexOf("?button1on") > 0) {
digitalWrite(led, HIGH);
}
if (readString.indexOf("?button1off") > 0) {
digitalWrite(led, LOW);
}

if (readString.indexOf("?button2on") > 0) {
for (pos = 0; pos < 180; pos += 3) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
microservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position

}
}
if (readString.indexOf("?button2off") > 0) {
for (pos = 180; pos >= 1; pos -= 3) // goes from 180 degrees to 0 degrees
{
microservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position

}
}
//clearing string for next read
readString = "";

}
}
}
}
}

code entre balise code </> édite ton post
pourquoi créer deux fois le même sujet?
http://forum.arduino.cc/index.php?topic=473664.0

Sauf que j'ai un problème lors de la rotation du moteur, celui-ci tourne en continu.

ca veut dire quoi?
un servo moteur va dans un sens jusqu'en butée ou dans l'autre, mais ne tourne pas en continu, sinon c'est juste un moteur

pepe:
... ou un servomoteur commandé en vitesse (improprement appelé « servo 360° ») ?

tu as raison, mais on a rien comme détail et en regardant le code, on peut penser un servo normal

for (pos = 0; pos < 180; pos += 3)

sans autre réponse, on ne le saura pas :wink:
ou alors, un autre post sera ouvert comme cela se passe depuis un moment pour certains :frowning:

Excusez-moi d'avoir fait un autre post, je pensais que mon premier post n'avait pas été publié car je le voyais pas afficher.. ^^

Sinon pour mon servomoteur, j'ai oublié de préciser que c'est effectivement comme l'a dit pepe c'est un servo 360°.

Et pour mon code, c'est en partie de la copie effectivement, mais j'ai modifié beaucoup de chose car il était pas adéquat pour mon projet.
Et comme je l'ai dit dans mon post, je suis débutant sur les moteurs donc j'ai copié ce que j'ai trouvé pour
for (pos = 0; pos < 180; pos += 3) .

Merci de vos réponses.