String inString = "";    // string to hold input
int controllo = 20;      // valore di set point grandezza da controllare

int controlloSP = 25;   // limiti della grandezza da controllare
int controlloMax = 80;   // limiti della grandezza da controllare
int controlloMin = 0;


void setup() {
 
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
}

void loop() {
  // Read serial input:
  while (Serial.available() > 0) {
    int inChar = Serial.read();
    if (isDigit(inChar)) {
      // convert the incoming byte to a char and add it to the string:
      inString += (char)inChar;
    }
    // if you get a newline, print the string, then the string's value:
    if (inChar == '\n') {
      // converto string in numero intero
      controllo = inString.toInt();  
      // clear the string for new input:
      inString = "";
    }
  }
  
  // controllo limiti grandezza 
  if (controllo> controlloMin && controllo < controlloMax) {
    if (controllo> controlloSP) { 
       Serial.println(">" + String(controlloSP));
    }    
  } 
  
  delay(1000);
}