Codice per servomotore ethernet ?

ok grazie ora ho capito :slight_smile: ..
ho modificato il codice come hai detto tu puoi dirmi se ho fatto bene ? grazie

#include <SPI.h>
#include <Ethernet.h>
#include <Servo.h> 

Servo myservo;

int pos = 0;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,0,239);
EthernetServer server(272);

void setup()
{
  delay(1000);
  Serial.begin(9600);
  Serial.println("inizio");
   
  myservo.attach(9);
  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
}

void loop()
{
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
    // an http request ends with a blank line
  //  boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.print("ricevuto: ");
        Serial.println(c);
          
        if (c == '8') {
        Serial.println("Ricevuto 8");
          
          for(pos = 0; pos < 180; pos += 1)
        {                                  // 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 
  } 
              
    }
       if(c=='2') {
       for(pos = 0; pos < 180; pos += 1)
       {
    myservo.write(pos);
    delay(15);
       }
   } 
       
    }
  }
}
      delay(1);
     // close the connection:
     client.stop();
 }